Example #1
0
 def circuit(x=None):
     qml.SqueezingEmbedding(features=x,
                            wires=range(n_wires),
                            method="phase",
                            c=1)
     qml.Beamsplitter(np.pi / 2, 0, wires=[0, 1])
     qml.SqueezingEmbedding(features=[0, 0],
                            wires=range(n_wires),
                            method="phase",
                            c=1)
     return [
         qml.expval(qml.NumberOperator(wires=0)),
         qml.expval(qml.NumberOperator(wires=1)),
     ]
Example #2
0
 def circuit(x=None):
     qml.SqueezingEmbedding(features=x,
                            wires=range(n_wires),
                            method="amplitude",
                            c=1)
     return [
         qml.expval(qml.NumberOperator(wires=0)),
         qml.expval(qml.NumberOperator(wires=1)),
     ]
Example #3
0
    def test_expansion(self, features):
        """Checks the queue for the default settings."""

        op = qml.SqueezingEmbedding(features=features, wires=range(3))
        tape = op.expand()

        assert len(tape.operations) == len(features)
        for idx, gate in enumerate(tape.operations):
            assert gate.name == "Squeezing"
            assert gate.parameters[0] == features[idx]
Example #4
0
 def circuit2():
     qml.SqueezingEmbedding(features, wires=["z", "a", "k"])
     return qml.expval(qml.Identity("z"))
Example #5
0
 def circuit():
     qml.SqueezingEmbedding(features, wires=range(3))
     return qml.expval(qml.Identity(0))
Example #6
0
def circuit_template(features):
    qml.SqueezingEmbedding(features, range(3))
    qml.Beamsplitter(0.5, 0, wires=[2, 1])
    qml.Beamsplitter(0.5, 0, wires=[1, 0])
    return qml.expval(qml.X(0))
Example #7
0
 def test_id(self):
     """Tests that the id attribute can be set."""
     template = qml.SqueezingEmbedding(np.array([1, 2]),
                                       wires=[0, 1],
                                       id="a")
     assert template.id == "a"
Example #8
0
 def circuit(x=None):
     qml.SqueezingEmbedding(features=x, wires=[0, 1])
     return qml.expval(qml.X(0))
Example #9
0
 def circuit(x=None):
     qml.SqueezingEmbedding(features=x,
                            wires=range(n_wires),
                            method="A")
     return [qml.expval(qml.X(i)) for i in range(n_wires)]