Esempio n. 1
0
 def test_mutual_information(self):
     input_state = np.array([[0.5, 0.25, 0.75, 1],
                             [1, 0, 1, 0],
                             [0.5, 0.5, 0.5, 0.5],
                             [0, 1, 0, 1]])
     res = mutual_information(input_state, 2)
     self.assertAlmostEqual(-0.15821825498448047, res)
Esempio n. 2
0
def discord(rho, qubit=0):
    """
    The quantum discord between two qubits
    
    Quantum discord is defined in Phys. Rev. Lett. 88, 017901 (2001). 
    We use base 2 for log.
    
    Args:
        rho (Array): a two-qubit density operator
        qubit (int): 0 or 1, the qubit on which the measurement is done (default 0)
    
    Return:
        float: quantum discord, between [0, 1]
    """
    return (mutual_information(rho, 2)/np.log(2) - classical_correlation(rho, qubit=qubit))