Exemple #1
0
 def _kraus_to_other_single(self, rep, qubits_test_cases, repetitions):
     """Test single Kraus to Other evolution."""
     for nq in qubits_test_cases:
         dim = 2**nq
         for _ in range(repetitions):
             rho = self.rand_rho(dim)
             kraus = self.rand_kraus(dim, dim, dim**2)
             chan1 = Kraus(kraus)
             rho1 = chan1._evolve(rho)
             chan2 = rep(chan1)
             rho2 = chan2._evolve(rho)
             self.assertAllClose(rho1, rho2)
Exemple #2
0
 def test_ptm_to_kraus(self):
     """Test PTM to Kraus transformation."""
     # Test unitary channels
     for mat, ptm in zip(self.unitary_mat, self.unitary_ptm):
         chan1 = Kraus(mat)
         chan2 = Kraus(PTM(ptm))
         self.assertTrue(
             matrix_equal(chan2.data[0], chan1.data[0], ignore_phase=True))
     # Test depolarizing channels
     rho = np.diag([1, 0])
     for p in [0.25, 0.5, 0.75, 1]:
         targ = Kraus(self.depol_kraus(p))._evolve(rho)
         chan = Kraus(PTM(self.depol_ptm(p)))
         self.assertAllClose(chan._evolve(rho), targ)