Source: cirosantilli/qiskit-initialize-py

= qiskit/initialize.py
{c}

In this example we will initialize a quantum circuit with a single <CNOT gate> and see the output values.

By default, <Qiskit> initializes every <qubit> to 0 as shown in the <qiskit/hello.py>{file}. But we can also initialize to arbitrary values as would be done when computing the output for various different inputs.

Output:
``
     ┌──────────────────────┐
q_0: ┤0                     ├──■──
     │  Initialize(1,0,0,0) │┌─┴─┐
q_1: ┤1                     ├┤ X ├
     └──────────────────────┘└───┘
c: 2/═════════════════════════════

init: [1, 0, 0, 0]
probs: [1. 0. 0. 0.]

init: [0, 1, 0, 0]
probs: [0. 0. 0. 1.]

init: [0, 0, 1, 0]
probs: [0. 0. 1. 0.]

init: [0, 0, 0, 1]
probs: [0. 1. 0. 0.]

     ┌──────────────────────────────────┐
q_0: ┤0                                 ├──■──
     │  Initialize(0.70711,0,0,0.70711) │┌─┴─┐
q_1: ┤1                                 ├┤ X ├
     └──────────────────────────────────┘└───┘
c: 2/═════════════════════════════════════════

init: [0.7071067811865475, 0, 0, 0.7071067811865475]
probs: [0.5 0.5 0.  0. ]
``
which we should all be able to understand intuitively given our understanding of the <CNOT gate> and <quantum state vectors>.

https://quantumcomputing.stackexchange.com/questions/13202/qiskit-initializing-n-qubits-with-binary-values-0s-and-1s describes how to initialize circuits qubits only with binary 0 or 1 to avoid dealing with the exponential number of elements of the <quantum state vector>.