예제 #1
0
 def circuit(x=None):
     DisplacementEmbedding(features=x,
                           wires=range(n_wires),
                           method='amplitude',
                           c=1.)
     return [
         qml.expval(qml.MeanPhoton(wires=0)),
         qml.expval(qml.MeanPhoton(wires=1))
     ]
예제 #2
0
 def circuit(x=None):
     DisplacementEmbedding(features=x,
                           wires=range(n_wires),
                           method='phase',
                           c=1.)
     Beamsplitter(pi / 2, 0, wires=[0, 1])
     DisplacementEmbedding(features=[0, 0],
                           wires=range(n_wires),
                           method='phase',
                           c=1.)
     return [
         qml.expval(qml.MeanPhoton(wires=0)),
         qml.expval(qml.MeanPhoton(wires=1))
     ]
예제 #3
0
 def circuit(varphi, bs):
     Interferometer(theta=None,
                    phi=None,
                    varphi=varphi,
                    beamsplitter=bs,
                    wires=0)
     return qml.expval(qml.MeanPhoton(0))
예제 #4
0
 def circuit(varphi, mesh):
     Interferometer(theta=None,
                    phi=None,
                    varphi=varphi,
                    mesh=mesh,
                    wires=0)
     return qml.expval(qml.MeanPhoton(0))
예제 #5
0
 def circuit_tria(varphi):
     Interferometer(theta,
                    phi,
                    varphi,
                    mesh='triangular',
                    beamsplitter='clements',
                    wires=wires)
     return [qml.expval(qml.MeanPhoton(w)) for w in wires]
def circuit(var):
    """Variational circuit.

    Args:
        var (array[float]): array containing the variables

    Returns:
        mean photon number of mode 0
    """
    qml.FockState(1, wires=0)
    qml.Beamsplitter(var[0], var[1], wires=[0, 1])

    return qml.expval(qml.MeanPhoton(0))
예제 #7
0
        def circuit(theta, phi, varphi):
            for w in wires:
                qml.Squeezing(sq[w][0], sq[w][1], wires=w)

            Interferometer(theta, phi, varphi, wires=wires)
            return [qml.expval(qml.MeanPhoton(w)) for w in wires]
예제 #8
0
 def circuit_rect(varphi):
     Interferometer(theta, phi, varphi, wires=wires)
     return [qml.expval(qml.MeanPhoton(w)) for w in wires]
예제 #9
0
 def circuit(varphi):
     Interferometer(theta, phi, varphi, mesh='triangular', wires=wires)
     return [qml.expval(qml.MeanPhoton(w)) for w in wires]