Skip to main content
7 votes

Qiskit: Initializing $n$ qubits with binary values ($0$s and $1$s)

qiskit-terra 0.16 or lower As answered, probably the most canonical way to do this is with Statevector.from_label and initialize....
luciano's user avatar
  • 5,813
5 votes
Accepted

How to initialize a $n$ qubit system in this specific state

You can generate an equal superposition on the first $n$ qubits using $H^{\otimes n}$, then use $n$ CNOT gates to get the desired state: This circuit has a depth of $2$
Egretta.Thula's user avatar
5 votes
Accepted

How is the state preparation Unitary in initialize selected?

As stated in this tutorial, qiskit relies on a method from this paper from implementing the initialize function. Note that this ...
Tristan Nemoz's user avatar
  • 6,702
5 votes

VQE restart from a previous computation

You can use a callback function to save the parameters for each iterations of your vqe algorithm and even store the mean, std. Below an example: ...
NABAT's user avatar
  • 121
5 votes
Accepted

Qiskit: Initializing $n$ qubits with binary values ($0$s and $1$s)

You can also create a Statevector, that can be directly initialized as follows: ...
e-eight's user avatar
  • 302
4 votes

Why after transpiling a Qiskit circuit we obtain a different result?

I have found the solution! The problem is that each time you use the transpile function, it generates a different transpiled circuit and the order of the outcome is not necessary the same as the order ...
Paula G's user avatar
  • 389
3 votes

How to get precise angle values in Qiskit while using initialize() function to generate arbitrary quantum state?

This is probably not the only way to do it, but you can always look at the QASM file. You can do it with qc.qasm(formatted=True), which will show you the underlying ...
Peter Ivashkov's user avatar
3 votes

Using QuantumCircuit.initialize() on a real quantum computer

The initialize method uses an algorithm to generate a set of gates that implement your input statevector. Therefore it can also be used on real hardware. But it is important to note, that this is a ...
Cryoris's user avatar
  • 2,953
3 votes
Accepted

How to pick number of simulation qubits for finding eigenvalue of fermionic Hamiltonian?

Typically the second option: you map the fermionic occupation number for each single-particle state to a qubit. (Also, the usual convention is that $0$ denotes unoccupied, $1$ denotes occupied ;) This ...
Will's user avatar
  • 253
2 votes
Accepted

Default value for a state created by QuantumRegister

Here's the source code for quantumregister.py and quantumcircuit.py. The default is $|0\rangle$. The code goes like: ...
Sanchayan Dutta's user avatar
2 votes
Accepted

Is there a "parameterized initialization" that I can apply to a QuantumRegister to re-use a circuit?

There is no replace() method, but you can do the trick by means of pop() and insert(). Example: ...
Michele Amoretti's user avatar
2 votes

Setting the Initial State of Density Matrix Simulation in Cirq

Instead of accessing results._final_simulator_state.density_matrix, which has a leading underscore implying you shouldn't be using it or relying on it to stay ...
Craig Gidney's user avatar
  • 38.5k
2 votes

Threshold and practical requirements for initial state preparation?

I'm probably late to party but I found this section today. In terms to answer your question[s] I made a lot of thoughts and read enough paper for a tree. I found 2 excellent experiments (very timely) ...
Ole Pannier's user avatar
1 vote

How to get precise angle values in Qiskit while using initialize() function to generate arbitrary quantum state?

Qiskit stores Instruction parameters in params attribute. So, you can access these values as follows: ...
Egretta.Thula's user avatar
1 vote

How to get precise angle values in Qiskit while using initialize() function to generate arbitrary quantum state?

you can extract it directly like this, I recommend using transpile to decompose all to ry gate instead, where draw() will show decimal place without round it to 3 ...
poig's user avatar
  • 632
1 vote

Survey of which 'physically interesting' many-body states can be efficiently prepared on a quantum computer?

This is only a partial answer, as it is not a survey paper/etc. and does not claim to be exhaustive, but the PhD thesis "Hamiltonian Complexity in Many-Body Quantum Physics" by James David ...
lm1909's user avatar
  • 93
1 vote
Accepted

Survey of which 'physically interesting' many-body states can be efficiently prepared on a quantum computer?

I think it is really tough to provide a complete and comprehensive list of conditions describing which states can be efficiently prepared, at least because we don't know how to split BQP from QMA yet, ...
Mark Spinelli's user avatar
1 vote
Accepted

How to initialize a function in Qiskit with 3 qubit?

Presumably $A^2 + B^2 + C^2 = 1$ temp = QuantumCircuit(3) temp.initialize([A, 0, 0, 0, B, 0, 0, C]) where I've put A, B, and C into the spots corresponding to 0, 4,...
Frank Yellin's user avatar
1 vote

Reducing circuit initialization complexity

I think that the QuantumCircuit.initialize() method isn't always providing the most efficient state preparations. I have tried to initialize some very simple states,...
Ohad's user avatar
  • 1,759
1 vote

How to initialize a $n$ qubit system in this specific state

@Ergetta.Thula's answer is complete. I just thought to add a little bit more to this discussion. In general, the following circuit takes the state $|0\rangle^{\otimes 2N}$ to the state $\sum_{i=1}^N \...
KAJ226's user avatar
  • 13.9k
1 vote

What are the mathematics and theory behind Initializing a quantum state vector?

Behind every array of $N$ qubits, there is an array of $2^N$ floats, each one of them is saving the amplitude $\alpha_{x_0...x_N}$ of the $|x_0...x_N \rangle$ state. The coding behind initializing is ...
Ron Cohen's user avatar
  • 1,482
1 vote
Accepted

From the final quantum state to the quantum circuit composition

If you initial state is $| 0\dots0\rangle$ and your final state is $|\psi\rangle$, than it is trivial to come up with some unitary matrix $U$, which preforms such transformation (it's first column ...
totikom's user avatar
  • 206
1 vote
Accepted

How to separate initializing qubits from runing algorithm several times

When you consider a quantum circuit, it is often (if not always) assumed that the circuit starts in the state where all the qubits are in state $|0\rangle$. The "initialization part" is ...
Tristan Nemoz's user avatar
  • 6,702
1 vote

Is there a "parameterized initialization" that I can apply to a QuantumRegister to re-use a circuit?

John Preskill identified the bottleneck you described as a fundamental problem in quantum deep learning (section 6.5, here). In particular, But typical proposals for quantum machine learning ...
Jonathan Trousdale's user avatar
1 vote

How can I initialize a state with chosen amplitudes in Qiskit?

All your real parts and imaginary parts are interchanged. Have you used complex(1,0) instead of complex(0,1) or something similar? Without the code one can only guess. Hope you can resolve it.
siddg's user avatar
  • 51
1 vote
Accepted

Prepending initial state to a quantum circuit in Qiskit

If you have the circuit, you can get the registers the circuit acts on from eigs_circ.qregs. You can then create another circuit using the returned quantum register,...
met927's user avatar
  • 3,251
1 vote

Default input states of qubits to quantum circuits

You have some quantum algorithms assuming you prepared a special input state which is not represented as a superposition of bitstrings. For example, you can just say you start in the $| + \rangle$ ...
cnada's user avatar
  • 4,754

Only top scored, non community-wiki answers of a minimum length are eligible