qiskit-ignis
qiskit-ignis copied to clipboard
Output Bloch vector
What is the expected behavior?
It would be good to have a tool that takes a single qubit circuit and outputs the corresponding Bloch vector.
I don't think this currently exists, and I don't think it fits with the philosophy of Terra. But perhaps it could go somewhere here in Ignis?
You can do this today pretty easily with terra. For example:
backend_sv_sim = qiskit.BasicAer.get_backend('statevector_simulator')
qr = qiskit.QuantumRegister(1)
cr = qiskit.ClassicalRegister(1)
circ = qiskit.QuantumCircuit(qr, cr)
circ.h(qr)
circ.sdg(qr)
result = qiskit.execute(circ, backend_sv_sim).result()
qiskit.visualization.plot_bloch_multivector(result.get_statevector())
(I just copy and pasted that from the qiskit workshop I've given in the past)
which returns:
Thanks.
I think that only works for the statevector simulator, does it not. For the qasm simulator or real devices, one needs to implement x, y and z measurements and process and combine the results.
Yes, that's true, I didn't realize that's what you were talking about. I just assumed you wanted to go from an arbitrary circuit to a bloch vector. But yeah if you're running on a real device or using the qasm simulator you'll have to do more analysis to get that. It definitely feels like ignis would be the right place to do that.
You could loop it in with the tomography code, but I would just make it as a notebook example