qml.from_pyquil

from_pyquil(pyquil_program)[source]

Loads pyQuil Program objects by using the converter in the PennyLane-Rigetti plugin.

Example:

>>> program = pyquil.Program()
>>> program += pyquil.gates.H(0)
>>> program += pyquil.gates.CNOT(0, 1)
>>> my_circuit = qml.from_pyquil(program)

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

pyquil_program (pyquil.Program) – a program created in pyQuil

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

Contents

Using PennyLane

Release news

Development

API

Internals