def test_transpose(self): """Test transpose method.""" stine_l, stine_r = self.rand_matrix(4, 2), self.rand_matrix(4, 2) # Single square Stinespring list targ = Stinespring(stine_l.T, 4, 2) chan1 = Stinespring(stine_l, 2, 4) chan = chan1.transpose() self.assertEqual(chan, targ) self.assertEqual(chan.dim, (4, 2)) # Double square Stinespring list targ = Stinespring((stine_l.T, stine_r.T), 4, 2) chan1 = Stinespring((stine_l, stine_r), 2, 4) chan = chan1.transpose() self.assertEqual(chan, targ) self.assertEqual(chan.dim, (4, 2))
def test_transpose_inplace(self): """Test inplace transpose method.""" stine_l, stine_r = self.rand_matrix(4, 4), self.rand_matrix(4, 4) # Single square Stinespring list targ = Stinespring(stine_l.T, 4, 4) chan1 = Stinespring(stine_l, 4, 4) chan1.transpose(inplace=True) self.assertEqual(chan1, targ) self.assertEqual(chan1.dims, (4, 4)) # Double square Stinespring list targ = Stinespring((stine_l.T, stine_r.T), 4, 4) chan1 = Stinespring((stine_l, stine_r), 4, 4) chan1.transpose(inplace=True) self.assertEqual(chan1, targ) self.assertEqual(chan1.dims, (4, 4))