qml.from_quil

from_quil(quil)[source]

Loads quantum circuits from a Quil string using the converter in the PennyLane-Rigetti plugin.

Example:

quil_str = 'H 0\nCNOT 0 1'
my_circuit = qml.from_quil(quil_str)

The my_circuit template can now be used within QNodes, as a two-wire quantum template.

@qml.qnode(dev)
def circuit(x):
    qml.RX(x, wires=1)
    my_circuit(wires=(1, 0))
    return qml.expval(qml.Z(0))
Parameters:

quil (str) – a Quil string containing a valid quantum circuit

Returns:

a pennylane_forest.ProgramLoader instance that can be used like a PennyLane template and that contains additional inspection properties

Return type:

pennylane_forest.ProgramLoader