Suppose I have a state in qiskit which is a product of states, for example:

$| \psi \rangle = \left(\frac{ \sqrt{2} | 000 \rangle + |111 \rangle} {\sqrt 3}\right) \left( \frac{ |00 \rangle + |11 \rangle}{\sqrt 2} \right) \left( |01 \rangle \right) $

I want to write a code which will return the state of qubit 4 and 5, i.e. $\frac{|00 \rangle + |11 \rangle}{\sqrt 2}$. One way to do this would be to use save_density_matrix(qubits = [4, 5]), and covert that to a statevector. However, that takes too much time if I am doing this many times. Given that I know that the qubits 4 and 5 are unentangled from the rest of the system, is there a way to extract their state directly?

Even if I take the partial trace, the output is still a density matrix.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.