def test_chi_tensor(self): """Test tensor of Chi matrices is correct.""" mats = [self.UI, self.UX, self.UY, self.UZ, self.UH] chans = [ Chi(mat) for mat in [self.chiI, self.chiX, self.chiY, self.chiZ, self.chiH] ] self._compare_tensor_to_operator(chans, mats)
def _chi_to_other(self, rep, qubits_test_cases, repetitions): """Test Chi to Other evolution.""" for nq in qubits_test_cases: dim = 2**nq for _ in range(repetitions): rho = self.rand_rho(dim) mat = self.rand_matrix(dim**2, dim**2, real=True) chan = Chi(mat) rho1 = DensityMatrix(rho).evolve(chan).data rho2 = DensityMatrix(rho).evolve(rep(chan)).data assert_allclose(rho1, rho2)
def test_chi_adjoint_random(self): """Test adjoint of Chi matrices is correct.""" mats = [self.rand_matrix(4, 4) for _ in range(4)] chans = [Chi(Operator(mat)) for mat in mats] self._compare_adjoint_to_operator(chans, mats)
def test_chi_adjoint(self): """Test adjoint of Chi matrices is correct.""" mats = self.unitaries chans = [Chi(mat) for mat in self.chis] self._compare_adjoint_to_operator(chans, mats)
def test_chi_transpose(self): """Test transpose of Chi matrices is correct.""" mats = self.unitaries chans = [Chi(mat) for mat in self.chis] self._compare_transpose_to_operator(chans, mats)
def test_chi_subtract_other_rep(self): """Test subtraction of Chi matrices is correct.""" chan = Chi(self.chiI) self._check_subtract_other_reps(chan)
def test_chi_add_other_rep(self): """Test addition of Chi matrices is correct.""" chan = Chi(self.chiI) self._check_add_other_reps(chan)
def test_chi_compose_other_reps(self): """Test compose of Chi works with other reps.""" chan = Chi(self.chiI) self._check_compose_other_reps(chan)
def test_chi_expand_other_reps(self): """Test expand of Chi works with other reps.""" chan = Chi(self.chiI) self._check_expand_other_reps(chan)
def test_chi_expand_random(self): """Test expand of Chi matrices is correct.""" mats = [self.rand_matrix(2, 2) for _ in range(4)] chans = [Chi(Operator(mat)) for mat in mats] self._compare_expand_to_operator(chans, mats)
def test_chi_tensor_other_reps(self): """Test tensor of Chi works with other reps.""" chan = Chi(self.chiI) self._check_tensor_other_reps(chan)
def test_chi_compose_random(self): """Test compose of Chi matrices is correct.""" mats = [self.rand_matrix(4, 4) for _ in range(4)] chans = [Chi(UnitaryChannel(mat)) for mat in mats] self._compare_compose_to_unitary(chans, mats)
def test_chi_conjugate(self): """Test conjugate of Chi matrices is correct.""" mats = self.unitaries chans = [Chi(mat) for mat in self.chis] self._compare_conjugate_to_unitary(chans, mats)