def test_is_unitary_no_channel(self, prog):
     """test that the is_unitary function returns True if no channels are present"""
     assert utils.is_unitary(prog)
     with prog.context as q:
         Sgate(0.4) | q[0]
         BSgate(0.4) | q
     assert utils.is_unitary(prog)
Exemple #2
0
    def test_is_unitary_no_channel(self):
        """test that the is_unitary function returns True if no channels are present"""
        eng, q = sf.Engine(2)

        assert utils.is_unitary(eng)

        with eng:
            Sgate(0.4) | q[0]
            BSgate(0.4) | q

        assert utils.is_unitary(eng)
 def test_is_unitary_with_channel(self, prog):
     """test that the is_unitary function returns False if channels are present"""
     with prog.context as q:
         Sgate(0.4) | q[0]
         LossChannel(0.4) | q[0]
         BSgate(0.4) | q
     assert not utils.is_unitary(prog)
Exemple #4
0
    def test_is_unitary_with_channel(self):
        """test that the is_unitary function returns False if channels are present"""
        eng, q = sf.Engine(2)

        with eng:
            Sgate(0.4) | q[0]
            LossChannel(0.4) | q[0]
            BSgate(0.4) | q

        assert not utils.is_unitary(eng)