First I made the circuit in jupyter notebook and ran it. Then I did the same thing in the IBM Quantum Composer, but I got different phases. Circuit in jupyter notebook Results in jupyter notebook Circuit and results in Quantum Composer
For the jupyter notebook version, I got a phase of 0 for the |111> state and a phase of pi for the |011> state.
On the Quantum Composer I got a phase of pi for the |111> state and a phase of 0 for the |011> state.
I have ran both the jupyter notebook and the Quantum Composer several times. I don't see any difference between the circuit from jupyter notebook and the circuit from the Quantum Composer. I believe the problem is in the jupyter notebook, because the results from the Quantum Composer seem right.
Here again is the code from my jupyter notebook:
qc = QuantumCircuit(3)
qc.x(0)
qc.x(1)
qc.h(2)
theta = pi/2
qc.cp(theta,1,2)
qc.cx(0,1)
qc.cp(-theta,1,2)
qc.cx(0,1)
qc.cp(theta,0,2)
qc.draw(output='mpl')
qc.save_statevector()
q = assemble(qc)
result = sim.run(q).result().get_statevector()
plot_state_qsphere(result)
I've imported:
from qiskit import *
%matplotlib inline
from qiskit.visualization import *
Simulator:
sim = Aer.get_backend('aer_simulator')
Quantum Composer:
OPENQASM 2.0;
include "qelib1.inc";
qreg q[3];
creg c[3];
x q[0];
x q[1];
h q[2];
cp(pi/2) q[1],q[2];
cx q[0],q[1];
cp(-pi/2) q[1],q[2];
cx q[0],q[1];
cp(pi/2) q[0],q[2];