PennyLane-IonQ Plugin¶
- Release:
0.36.0
The PennyLane-IonQ plugin provides the ability to use IonQ’s ion-trap quantum computing backends with PennyLane.
PennyLane provides open-source tools for quantum machine learning, quantum computing, quantum chemistry, and hybrid quantum-classical computing.
IonQ is a ion-trap quantum computing company offering access to quantum computing devices over the cloud.
Once the PennyLane-IonQ plugin is installed, the two provided IonQ devices can be accessed straight away in PennyLane, without the need to import any additional packages.
Devices¶
PennyLane-IonQ provides two IonQ devices for PennyLane:
Both devices support the same operations, including IonQ’s
custom XX
, YY
, and ZZ
gates.
Remote backend access¶
The user will need access credentials for the IonQ platform in order to
use these remote devices. These credentials should be provided to PennyLane via a
configuration file or environment variable.
Specifically, the variable IONQ_API_KEY
must contain a valid access key for IonQ’s online platform.
Installation¶
PennyLane-IonQ only requires PennyLane for use, no additional external frameworks are needed.
The plugin can be installed via pip
:
$ python3 -m pip install pennylane-ionq
Alternatively, you can install PennyLane-IonQ from the source code by navigating to the top directory and running
$ python3 setup.py install
If you currently do not have Python 3 installed, we recommend Anaconda for Python 3, a distributed version of Python packaged for scientific computation.
Software tests¶
To ensure that PennyLane-IonQ is working correctly after installation, the test suite can be run by navigating to the source code folder and running
$ make test
Documentation¶
To build the HTML documentation, go to the top-level directory and run
$ make docs
The documentation can then be found in the doc/_build/html/
directory.
Support¶
Source Code: https://github.com/PennyLaneAI/pennylane-ionq
Issue Tracker: https://github.com/PennyLaneAI/pennylane-ionq/issues
If you are having issues, please let us know by posting the issue on our GitHub issue tracker.
IonQ Devices¶
The PennyLane-IonQ plugin provides the ability for PennyLane to access devices available via IonQ’s online API.
Currently, access is available to two remote devices: one to access an ideal trapped-ion simulator and another to access to IonQ’s trapped-ion QPUs.
Ideal trapped-ion simulator¶
The SimulatorDevice
provides an ideal noiseless trapped-ion simulation.
Once the plugin has been installed, you can use this device directly in PennyLane by specifying "ionq.simulator"
:
import pennylane as qml
from pennylane_ionq import ops
dev = qml.device("ionq.simulator", wires=2)
@qml.qnode(dev)
def circuit(x, y, z):
qml.RX(w, wires=0)
ops.YY(y, wires=[0,1])
ops.ZZ(z, wires=[0,1])
return qml.expval(qml.PauliZ(0))
Trapped-Ion QPU¶
The QPUDevice
provides access to IonQ’s trapped-ion QPUs. Once the plugin has been
installed, you can use this device directly in PennyLane by specifying "ionq.qpu"
with a
"backend"
from available backends:
import pennylane as qml
from pennylane_ionq import ops
dev = qml.device("ionq.qpu", backend="harmony", wires=2)
@qml.qnode(dev)
def circuit(x, y):
qml.XX(x, wires=[0, 1])
ops.YY(y, wires=[0, 1])
return qml.expval(qml.PauliZ(0))
Both devices support the same set of operations.
IonQ Operations¶
PennyLane-IonQ provides three gates specific to IonQ’s ion-trap API:
|
The Ising XX gate. |
|
The Ising YY gate. |
|
The Ising ZZ gate. |
These three gates can be imported from pennylane_ionq.ops
.
Remote backend access¶
Access credentials will be needed for the IonQ platform in order to
use these remote devices. These credentials should be provided to PennyLane via a
configuration file or environment variable.
Specifically, the variable IONQ_API_KEY
must contain a valid access key for IonQ’s online platform.
pennylane_ionq¶
This section contains the API documentation for the PennyLane-IonQ plugin.
Warning
Unless you are a PennyLane plugin developer, you likely do not need to use these classes and functions directly.
See the overview page for more details using the available IonQ devices with PennyLane.
PennyLane IonQ overview¶
Classes¶
|
Single-qubit GPI gate. |
|
Single-qubit GPI2 gate. |
|
2-qubit entangling MS gate. |
|
QPU device for IonQ. |
|
Simulator device for IonQ. |
|
The Ising XX gate. |
|
The Ising YY gate. |
|
The Ising ZZ gate. |
Class Inheritance Diagram¶

pennylane_ionq.ops¶
Custom operations
Classes¶
|
Single-qubit GPI gate. |
|
Single-qubit GPI2 gate. |
|
2-qubit entangling MS gate. |
|
The Ising XX gate. |
|
The Ising YY gate. |
|
The Ising ZZ gate. |