PennyLane-Qiskit Plugin¶
- Release:
0.34.0-dev
The PennyLane-Qiskit plugin integrates the Qiskit quantum computing framework with PennyLane’s quantum machine learning capabilities.
PennyLane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.
Qiskit is an open-source framework for quantum computing.
Once the PennyLane-Qiskit plugin is installed, the the Qiskit devices can be accessed straightaway in PennyLane, without the need to import new packages.
Devices¶
Currently, there are three different devices available:
For example, the 'qiskit.aer'
device with two wires is called like this:
import pennylane as qml
dev = qml.device('qiskit.aer', wires=2)
Backends¶
Qiskit devices have different backends, which define which actual simulator or hardware is used by the device. Different simulator backends are optimized for different types of circuits. A backend can be defined as follows:
dev = qml.device('qiskit.aer', wires=2, backend='unitary_simulator')
PennyLane chooses the qasm_simulator
as the default backend if no backend is specified.
For more details on the qasm_simulator
, including available backend options, see
Qiskit Qasm Simulator documentation.
Tutorials¶
Check out these demos to see the PennyLane-Qiskit plugin in action:
You can also try it out using any of the qubit based demos from the PennyLane documentation, for example the tutorial on
qubit rotation.
Simply replace 'default.qubit'
with any of the available Qiskit devices,
such as 'qiskit.aer'
, or 'qiskit.ibmq'
if you have an API key for
hardware access.