Getting started¶
You can use the state preparation as follows
from dc_qiskit_algorithms.MöttönenStatePrep import state_prep_möttönen
vector = [-0.1, 0.2, -0.3, 0.4, -0.5, 0.6, -0.7, 0.8]
vector = numpy.asarray(vector)
vector = (1 / numpy.linalg.norm(vector)) * vector
qubits = int(numpy.log2(len(vector)))
reg = QuantumRegister(qubits, "reg")
c = ClassicalRegister(qubits, "c")
qc = QuantumCircuit(reg, c, name='state prep')
state_prep_möttönen(qc, vector, reg)
After this, the quantum circuit is prepared in the given state. All complex vectors are possible!