Skip to content

Instantly share code, notes, and snippets.

@pdc-quantum
Last active May 4, 2022 15:15
Show Gist options
  • Save pdc-quantum/ef2582150b0b9e2fe43290ee1891670c to your computer and use it in GitHub Desktop.
Save pdc-quantum/ef2582150b0b9e2fe43290ee1891670c to your computer and use it in GitHub Desktop.
four-general_statevector.py
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')
@pdc-quantum
Copy link
Author

change title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment