from qiskit.circuit.library import QFT
from qiskit import *
from qiskit.visualization import *
backend = BasicAer.get_backend('statevector_simulator')
qc000 = QFT(3)
job000 = execute(qc000, backend).result()
result000 = job000.result()
plot_bloch_multivector(result000.get_statevector())
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
qc001 = QuantumCircuit(3)
qc001.x(0)
<qiskit.circuit.instructionset.InstructionSet at 0x7fe90fcadb50>
qc001 = qc001 + QFT(3)
<ipython-input-16-d7cc1db18362>:1: DeprecationWarning: The QuantumCircuit.__add__() method is being deprecated.Use the compose() method which is more flexible w.r.t circuit register compatibility. qc001 = qc001 + QFT(3) /home/al/.local/lib/python3.9/site-packages/qiskit/circuit/quantumcircuit.py:869: DeprecationWarning: The QuantumCircuit.combine() method is being deprecated. Use the compose() method which is more flexible w.r.t circuit register compatibility. return self.combine(rhs)
qc001.draw()
┌───┐ ┌───┐ q_0: ┤ X ├──────────■─────────────■───────┤ H ├─X─ └───┘ │ ┌───┐ │P(π/2) └───┘ │ q_1: ──────■────────┼───────┤ H ├─■─────────────┼─ ┌───┐ │P(π/2) │P(π/4) └───┘ │ q_2: ┤ H ├─■────────■───────────────────────────X─ └───┘
job001 = execute(qc001, backend)
result001 = job001.result()
plot_bloch_multivector(result001.get_statevector())
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
qc100 = QuantumCircuit(3)
qc100.x(2)
<qiskit.circuit.instructionset.InstructionSet at 0x7fe90e1dbee0>
qc100 = qc100 + QFT(3)
job100 = execute(qc100, backend)
result100 = job100.result()
plot_bloch_multivector(result100.get_statevector())
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
qc010 = QuantumCircuit(3)
qc010.x(1)
<qiskit.circuit.instructionset.InstructionSet at 0x7fe90dbf90d0>
qc010 = qc010 + QFT(3)
job010=execute(qc010,backend)
result010 = job010.result()
plot_bloch_multivector(result010.get_statevector())
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
qc011 = QuantumCircuit(3)
qc011.x(0)
<qiskit.circuit.instructionset.InstructionSet at 0x7fe90d965f10>
qc011.x(1)
<qiskit.circuit.instructionset.InstructionSet at 0x7fe90da63100>
qc011 = qc011 + QFT(3)
job011=execute(qc011,backend)
result011 = job011.result()
plot_bloch_multivector(result011.get_statevector())
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
qcsp = QuantumCircuit(3)
qcsp.h(0)
<qiskit.circuit.instructionset.InstructionSet at 0x7f565c182bb0>
qcsp.x(1)
<qiskit.circuit.instructionset.InstructionSet at 0x7f56b0593460>
qcsp = qcsp +QFT(3)
qcsp.draw()
┌───┐ ┌───┐ q_0: ┤ H ├──────────■─────────────■───────┤ H ├─X─ ├───┤ │ ┌───┐ │P(π/2) └───┘ │ q_1: ┤ X ├─■────────┼───────┤ H ├─■─────────────┼─ ├───┤ │P(π/2) │P(π/4) └───┘ │ q_2: ┤ H ├─■────────■───────────────────────────X─ └───┘
job_011_010sp=execute(qcsp,backend).result()
plot_bloch_multivector(job_011_010sp.get_statevector(decimals=3))
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
qcsp2 = QuantumCircuit(3)
qcsp2.h(0)
<qiskit.circuit.instructionset.InstructionSet at 0x7f5659dc0160>
qcsp2 = qcsp2 + QFT(3)
qcsp2.draw()
┌───┐ ┌───┐ q_0: ┤ H ├──────────■─────────────■───────┤ H ├─X─ └───┘ │ ┌───┐ │P(π/2) └───┘ │ q_1: ──────■────────┼───────┤ H ├─■─────────────┼─ ┌───┐ │P(π/2) │P(π/4) └───┘ │ q_2: ┤ H ├─■────────■───────────────────────────X─ └───┘
job001_000=execute(qcsp2,backend).result()
plot_bloch_multivector(job001_000.get_statevector())
/home/al/.local/lib/python3.9/site-packages/qiskit/visualization/bloch.py:69: MatplotlibDeprecationWarning: The M attribute was deprecated in Matplotlib 3.4 and will be removed two minor releases later. Use self.axes.M instead. x_s, y_s, _ = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)