Exemplo n.º 1
0
 def test_is_channel_no_measurement(self, prog):
     """test that the is_channel function returns True if no measurements are present"""
     assert utils.is_channel(prog)
     with prog.context as q:
         Sgate(0.4) | q[0]
         LossChannel(0.4) | q[0]
         BSgate(0.4) | q
     assert utils.is_channel(prog)
Exemplo n.º 2
0
 def test_is_channel_preparation(self, prog):
     """is_channel() returns False if preparations are present"""
     with prog.context as q:
         Sgate(0.4) | q[0]
         BSgate() | q
         Squeezed(0.4) | q[1]
     assert not utils.is_channel(prog)
Exemplo n.º 3
0
 def test_is_channel_measurement(self, prog):
     """is_channel() returns False if measurements are present"""
     with prog.context as q:
         Sgate(0.4) | q[0]
         BSgate() | q
         MeasureX | q[0]
         Sgate(0.4) | q[1]
     assert not utils.is_channel(prog)
Exemplo n.º 4
0
    def test_is_channel_no_measurement(self):
        """test that the is_channel function returns True if no measurements are present"""
        eng, q = sf.Engine(2)

        assert utils.is_channel(eng)

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

        assert utils.is_channel(eng)

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

        assert utils.is_channel(eng)
Exemplo n.º 5
0
    def test_is_channel_measurement(self):
        """test that the is_channel function returns False if measurements
        or preparations are present"""
        eng, q = sf.Engine(2)

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

        assert not utils.is_channel(eng)

        eng.reset()

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

        assert not utils.is_channel(eng)