qml.from_qiskit

from_qiskit(quantum_circuit)[source]

Loads Qiskit QuantumCircuit objects by using the converter in the PennyLane-Qiskit plugin.

Example:

>>> qc = qiskit.QuantumCircuit(2)
>>> qc.rz(0.543, [0])
>>> qc.cx(0, 1)
>>> my_circuit = qml.from_qiskit(qc)

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.PauliZ(0))
Parameters

quantum_circuit (qiskit.QuantumCircuit) – a quantum circuit created in qiskit

Returns

the PennyLane template created based on the QuantumCircuit object

Return type

function