How to use the pennylane.RY function in PennyLane

To help you get started, we’ve selected a few PennyLane examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github XanaduAI / pennylane / tests / test_operation.py View on Github external
def circuit(x):
            qml.RX(x, wires=[0])
            qml.CNOT(wires=[0, 1], do_queue=False)
            qml.RY(0.4, wires=[0])
            qml.RZ(-0.2, wires=[1], do_queue=False)
            return qml.expval(qml.PauliX(0)), qml.expval(qml.PauliZ(1))
github XanaduAI / pennylane / tests / qnodes / test_qnode_qubit.py View on Github external
def circuit(a):
            qml.RX(a, wires=0)
            qml.RY(a, wires=0)
            return qml.var(qml.PauliZ(0))
github XanaduAI / pennylane / tests / qnode_new / test_qnode_base.py View on Github external
def circuit(x, y):
            qml.RX(x, wires=[0])
            qml.RY(y, wires=[1])
            qml.CNOT(wires=[0, 1])
            return qml.sample(qml.PauliZ(0) @ qml.PauliX(1))
github XanaduAI / pennylane / tests / test_decorator.py View on Github external
def circuit2(a, b):
            qml.RX(a, wires=0)
            qml.RY(b, wires=0)
            return qml.expval(qml.PauliZ(wires=0))
github XanaduAI / pennylane / tests / test_qnode.py View on Github external
def qf(x, y):
            qml.RX(x, wires=[0])
            qml.RY(x, wires=[0])
            return qml.expval(qml.Hermitian(np.diag([y, 1]), 0))
github XanaduAI / pennylane / tests / test_qnode.py View on Github external
def layer2_diag(x, y, z, h, g, f):
            non_parametrized_layer(a, b, c)
            qml.RX(x, wires=0)
            qml.RY(y, wires=1)
            qml.RZ(z, wires=2)
            non_parametrized_layer(a, b, c)
            qml.RY(f, wires=2)
            return qml.var(qml.PauliX(1))
github XanaduAI / pennylane / tests / test_optimize.py View on Github external
def quant_fun_flat(var):
    qml.RX(var[0], wires=[0])
    qml.RY(var[1], wires=[0])
    qml.RY(var[2], wires=[0])
    qml.RX(var[3], wires=[0])
    return qml.expval(qml.PauliZ(0))
github XanaduAI / qml / demonstrations / tutorial_quantum_transfer_learning.py View on Github external
def RY_layer(w):
    """Layer of parametrized qubit rotations around the y axis.
    """
    for idx, element in enumerate(w):
        qml.RY(element, wires=idx)
github XanaduAI / qml / demonstrations / tutorial_coherent_vqls.py View on Github external
def U_c():
    """Unitary matrix rotating the ground state of the ancillary qubits
    to |sqrt(c)> = U_c |0>."""
    # Circuit mapping |00> to sqrt_c[0] |00> + sqrt_c[1] |01> + sqrt_c[2] |10>
    qml.RY(-2 * np.arccos(sqrt_c[0]), wires=ancilla_idx)
    qml.CRY(-2 * np.arctan(sqrt_c[2] / sqrt_c[1]), wires=[ancilla_idx, ancilla_idx + 1])
    qml.CNOT(wires=[ancilla_idx + 1, ancilla_idx])
github XanaduAI / pennylane / examples / pennylane_run_variational_classifier.py View on Github external
def statepreparation(a):
    qml.RY(a[0], wires=0)

    qml.CNOT(wires=[0, 1])
    qml.RY(a[1], wires=1)
    qml.CNOT(wires=[0, 1])
    qml.RY(a[2], wires=1)

    qml.PauliX(wires=0)
    qml.CNOT(wires=[0, 1])
    qml.RY(a[3], wires=1)
    qml.CNOT(wires=[0, 1])
    qml.RY(a[4], wires=1)
    qml.PauliX(wires=0)

PennyLane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.

Apache-2.0
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis