Last active
May 4, 2022 15:15
-
-
Save pdc-quantum/ef2582150b0b9e2fe43290ee1891670c to your computer and use it in GitHub Desktop.
four-general_statevector.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from qiskit import QuantumCircuit | |
# define the state vector | |
init_list = np.array( [0., 0., 0., 0., 0., 0., 0., 6.**.5, | |
0., +1., +1., 0., +1., 0., 0., 0., | |
0., 0., 0., +1., 0., +1., +1., 0., | |
6.**.5, 0., 0., 0., 0., 0., 0., 0.]) / np.sqrt(18) | |
# create the circuit | |
circuit = QuantumCircuit(5) | |
circuit.initialize(init_list, circuit.qubits) | |
# add Pauli-Z measurements and draw the circuit | |
circuit.measure_active() | |
circuit.draw(output='mpl') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
change title