mirror of
https://github.com/quantumjim/Quantum-Computation-course-Basel.git
synced 2026-10-05 06:28:28 +02:00
2.6 KiB
2.6 KiB
In [1]:
"""
For 2×2 and 2×3 systems, the Positive Partial Transpose (PPT) criterion is necessary and sufficient for separability.
Exercises:
- Extend to a 2×3 example by padding qubits or adding a qutrit toy model with dims=(2,3).
- Wrap into a helper function `is_entangled_ppt(rho, dims)`.
"""Out [1]:
'\nFor 2×2 and 2×3 systems, the Positive Partial Transpose (PPT) criterion is necessary and sufficient for separability.\n\nExercises:\n- Extend to a 2×3 example by padding qubits or adding a qutrit toy model with dims=(2,3).\n- Wrap into a helper function `is_entangled_ppt(rho, dims)`.\n'
In [2]:
import numpy as np
from qiskit.quantum_info import Statevector, DensityMatrix
phi = Statevector([1,0,0,1])/np.sqrt(2)
rho_pure = DensityMatrix(phi).data
I4 = np.eye(4)/4
def isotropic(p):
# |Φ+> density matrix with simple depolarizing noise when p<1
return p*rho_pure + (1-p)*I4
for p in [1.0, 0.8, 0.6, 0.4]:
rho = isotropic(p)
rho_pt = DensityMatrix.partial_transpose(DensityMatrix(rho), [1]).data
eig = np.linalg.eigvalsh(rho_pt)
print(f"p={p} min eig(ρ^T_B)={eig.min(): .6e} {'ENTANGLED' if eig.min()< -1e-10 else 'PPT'}")p=1.0 min eig(ρ^T_B)=-5.000000e-01 ENTANGLED p=0.8 min eig(ρ^T_B)=-3.500000e-01 ENTANGLED p=0.6 min eig(ρ^T_B)=-2.000000e-01 ENTANGLED p=0.4 min eig(ρ^T_B)=-5.000000e-02 ENTANGLED
In [ ]: