Ejemplo n.º 1
0
    def test_subtract_inplace(self):
        """Test inplace subtract method."""
        mat1 = 0.5 * self.sopI
        mat2 = 0.5 * self.depol_sop(1)
        targ = SuperOp(mat1 - mat2)

        chan1 = SuperOp(mat1)
        chan2 = SuperOp(mat2)
        chan1.subtract(chan2, inplace=True)
        self.assertEqual(chan1, targ)

        chan1 = SuperOp(mat1)
        chan2 = SuperOp(mat2)
        chan1 -= chan2
        self.assertEqual(chan1, targ)
Ejemplo n.º 2
0
    def test_subtract(self):
        """Test subtract method."""
        mat1 = 0.5 * self.sopI
        mat2 = 0.5 * self.depol_sop(1)
        targ = SuperOp(mat1 - mat2)

        chan1 = SuperOp(mat1)
        chan2 = SuperOp(mat2)
        self.assertEqual(chan1.subtract(chan2), targ)
        self.assertEqual(chan1 - chan2, targ)