2
$\begingroup$

I need to calculate the negativity of a density matrix; in doing so on Qiskit I stuck on the problem of computing the partial transpose for a problem of compatibility.

Basically I extract my density matrix from a circuit via the Aer simulator in the following way:

circuit.append(SaveDensityMatrix(size, label = f'pho_%.1f' % (label)), [i for i in qubits])

aer_sim = Aer.get_backend('aer_simulator')
t_qc = transpile(circuit, aer_sim)
qobj = assemble(t_qc)
results = aer_sim.run(qobj, shots = 1).result()
counts = results.get_counts()

density_matrix = results.data()['pho_%.1f' % (i)]

the object resulting from this has the type :

qiskit_aer.backends.compatibility.DensityMatrix

How can I use the method partial_transpose described here as qiskit.quantum_info.DensityMatrix.partial_transpose?

https://qiskit.org/documentation/stubs/qiskit.quantum_info.DensityMatrix.partial_transpose.html

$\endgroup$

2 Answers 2

1
$\begingroup$

For calculating the negativity measure of a density matrix, there is a function for this in the toqito quantum information package here. It accepts a numpy array of the density matrix, so this is compatible with your Qiskit code (you can cast the rho as a numpy array). The source code also contains the implementation for how to compute the partial transpose.

$\endgroup$
0
$\begingroup$

Assume that the subsystems to be transposed are the first two qubits, that is, qubits with indexes 0 and 1. Then you can simply get the partially transposed density matrix as follows:

rho = density_matrix.partial_transpose([0, 1])

# Display rho:
from qiskit.visualization import array_to_latex
array_to_latex(rho)
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.