3

Suppose I have a quantum circuit defined in pytket, qiskit or some other quantum SDK.

How do I compile my circuit to be in the native gateset of the Quantinuum trapped ion device/emulators?

Callum
  • 1,260
  • 1
  • 5
  • 24

1 Answers1

3

You can do this with the pytket-quantinuum extension. This is installed as a separate python package.

I'll show an example. First I'll build a quantum circuit and then compile it to the native gateset.

from pytket import Circuit
from pytket.circuit.display import render_circuit_jupyter as draw

circ = Circuit(2) circ.H(0) circ.Rz(0.75, 0) circ.CX(0, 1) circ.measure_all()

draw(circ) # Draw circuit

enter image description here

Here I've defined a pytket Circuit by hand. You could also load in a Circuit from a QASM file or convert a qiskit QuantumCircuit using the pytket-qiskit extension.

Next we can initialise our QuantinuumBackend. This is the interface between pytket and the device/emulator.

from pytket.extensions.quantinuum import QuantinuumBackend

Backend for the H1-1 device

h1_backend = QuantinuumBackend("H1-1", machine_debug=True) compiled_circ = h1_backend.get_compiled_circuit(circ)

draw(compiled_circ) # Draw compiled circuit

enter image description here

We see that our circuit is now in the native gateset of the H1-1 device. This gateset is $\{\text{Rz}, \text{PhasedX}, \text{ZZPhase}\}$. The $\text{Rz}$ gate isn't needed here.

The entangling $\text{ZZPhase}$ gate is defined as follows...

$$ \begin{equation} \text{ZZPhase}(\theta) = \exp\Big(-i \frac{\pi \theta}{2} (Z \otimes Z )\Big) \end{equation} $$

This parameterised gate is quite expressive and is maximally entangling for $\theta = 0.5$.

The $\text{PhasedX}$ gate is simply a sequence of single qubit rotations.

$$ \begin{equation} \text{PhasedX}(\alpha, \beta) = \text{Rz}(\beta)\, \text{Rx}(\alpha)\, \text{Rz}(-\beta) \end{equation} $$

A couple points are worth noting here.

  1. Firstly I've set the machine_debug flag to True when initialising the QuantinuumBackend. This allows me to compile a circuit without needing Quantinuum credentials. If I don't use this I'll be prompted for a login.
  2. By default QuantinuumBackend.get_compiled_circuit performs a tailored sequence of optimisations to the input circuit. See the docs for details. You can turn circuit optimisations off by setting optimisation_level=0.
Callum
  • 1,260
  • 1
  • 5
  • 24