pytket-quantinuum¶
pytket-quantinuum is an extension to pytket that allows pytket circuits to
be compiled for execution on Quantinuum’s quantum devices. As of version 0.56.0
it no longer allows submission to Quantinuum devices: please use the qnexus
package for that.
pytket-quantinuum is available for Python 3.10, 3.11 and 3.12, on Linux, MacOS
and Windows. To install, run:
pip install pytket-quantinuum
Available Backends¶
The pytket-quantinuum extension allows the user to access the following quantum emulators. These backends can be initialised by passing the device name as a string to the QuantinuumBackend class. The available devices are:
H2-1LE, a version of theH2-1Eemulator that runs locally. For running simulations locally, see the docs on Local Emulators.
Default Compilation¶
Every Backend in pytket has its own default_compilation_pass() method.
This method applies a sequence of optimisations to a circuit depending on the value of an optimisation_level parameter.
This default compilation will ensure that the circuit meets all the constraints required to run on the Backend.
The default pass can be applied in place as follows
from pytket import Circuit
from pytket.extensions.quantinuum import QuantinuumBackend
circ = Circuit(2).H(0).CX(0, 1).CZ(0, 1)
backend = QuantinuumBackend('H2-1E')
# Compile the circuit in place. The optimisation level is set to 2 by default.
backend.default_compilation_pass().apply(circ)
Alternatively the default pass can be applied using the get_compiled_circuit() method.
compiled_circ = backend.get_compiled_circuit(circ)
The passes applied by different levels of optimisation are specified in the table below. Note that optimisation level 0, 1 and 2 do not remove barriers from a circuit, while optimisation level 3 will. At optimisation level 3 the default timeout is 5 minutes - consider increasing this for larger circuits if the circuit 2-qubit gate count is not reduced after compilation.
optimisation_level = 0 |
optimisation_level = 1 |
optimisation_level = 2 [1] |
optimisation_level = 3 |
|---|---|---|---|
|
|||
|
|
||
|
|
|
|
|
|
|
|
|
|||
|
|||
|
|
||
[1] If no value is specified then
optimisation_leveldefaults to a value of 2.[2]
AutoRebase()is a rebase that converts the circuit to the Quantinuum native gate set (e.g. \(\{Rz, PhasedX, ZZMax, ZZPhase\}\)).[3]
FullPeepholeOptimise()has the argumenttarget_2qb_gate=OpType.TK2.[4]
AutoSquash()targets the \(\{PhasedX, Rz\}\) gate set, i.e.AutoSquash({OpType.PhasedX, OpType.Rz}).[5] Omitted if the target two-qubit gate is
OpType.TK2.
Note
If optimisation_level = 0 the device constraints are solved but no additional optimisation is applied. Setting optimisation_level = 1 applies some light optimisations to the circuit. More intensive optimisation is applied by level 2 at the expense of increased runtime.
Note
The pass ZZPhaseToRz() is left out of optimisation_level=2 as the passes applied by FullPeepholeOptimise() will already cover these optimisations.
Target Two-Qubit Gate¶
Backends may offer several alternatives as the native two-qubit gate: the
current possibilities are ZZMax, ZZPhase and TK2. The set of
supported gates may be queried using the
two_qubit_gate_set property. Each device also has a
default two-qubit gate, which may be queried using the
default_two_qubit_gate property. Currently, the default
two-qubit gate for all devices is ZZPhase.
The default compilation pass and rebase pass will target the default gate by
default. This may be overridden using the method
set_compilation_config_target_2qb_gate() or by passing a
QuantinuumBackendCompilationConfig when constructing the backend.
Device Predicates¶
Circuits must satisfy the following predicates in order to run on the QuantinuumBackend.
NoSymbolsPredicate: Parameterised gates must have numerical parameters when the circuit is executed.GateSetPredicate: To view supported Ops runQuantinuumBackend.backend_info.gate_set.MaxNQubitsPredicate:H2-1,H2-1EandH2-1SCall support a maximum of 56 qubits.
Local Emulators¶
If pytket-quantinuum is installed with the pecos option:
pip install pytket-quantinuum[pecos]
For uv virtual enviroments it is possible that this does not work, because prereleases are not picked up automatically. This can be solved by installing the latest pytket-pecos version via:
uv pip install pytket-pecos --prerelease=allow
then it is possible to run circuits on an emulator running on the local machine.
Currently this emulation is noiseless.
- API documentation
LanguageQuantinuumBackendQuantinuumBackend.pass_from_info()QuantinuumBackend.__init__()QuantinuumBackend.available_devices()QuantinuumBackend.circuit_status()QuantinuumBackend.default_compilation_pass()QuantinuumBackend.device_state()QuantinuumBackend.get_compilation_config()QuantinuumBackend.get_compiled_circuit()QuantinuumBackend.get_compiled_circuits()QuantinuumBackend.get_jobid()QuantinuumBackend.get_ppcirc_rep()QuantinuumBackend.get_result()QuantinuumBackend.get_results_selection()QuantinuumBackend.get_results_width()QuantinuumBackend.process_circuits()QuantinuumBackend.rebase_pass()QuantinuumBackend.set_compilation_config_allow_implicit_swaps()QuantinuumBackend.set_compilation_config_target_2qb_gate()QuantinuumBackend.backend_infoQuantinuumBackend.compilation_configQuantinuumBackend.default_two_qubit_gateQuantinuumBackend.is_local_emulatorQuantinuumBackend.required_predicatesQuantinuumBackend.two_qubit_gate_set
QuantinuumBackendCompilationConfigBackendOfflineErrorBatchingUnsupportedDeviceNotAvailableGetResultFailedLanguageUnsupportedMaxShotsExceededNoSyntaxCheckerQuantinuumBackendDataH2QuantinuumAPIQuantinuumAPIOfflineQuantinuumConfigset_quantinuum_config()WasmUnsupportedQuantinuumAPIError
- Changelog
- 0.56.1 (December 2025)
- 0.55.1 (November 2025)
- 0.54.0 (October 2025)
- 0.53.0 (August 2025)
- 0.52.0 (July 2025)
- 0.51.0 (July 2025)
- 0.50.0 (June 2025)
- 0.48.0 (May 2025)
- 0.47.0 (May 2025)
- 0.46.0 (April 2025)
- 0.45.0 (March 2025)
- 0.44.0 (February 2025)
- 0.43.0 (January 2025)
- 0.42.0 (December 2024)
- 0.41.0 (November 2024)
- 0.40.0 (November 2024)
- 0.39.0 (November 2024)
- 0.38.1 (October 2024)
- 0.38.0 (October 2024)
- 0.37.0 (August 2024)
- 0.36.0 (July 2024)
- 0.35.0 (June 2024)
- 0.34.1 (June 2024)
- 0.34.0 (June 2024)
- 0.33.0 (April 2024)
- 0.32.0 (March 2024)
- 0.31.0 (March 2024)
- 0.30.0 (February 2024)
- 0.29.0 (January 2024)
- 0.28.0 (January 2024)
- 0.27.0 (January 2024)
- 0.26.0 (November 2023)
- 0.25.0 (October 2023)
- 0.24.0 (October 2023)
- 0.23.0 (September 2023)
- 0.22.0 (September 2023)
- 0.21.0 (September 2023)
- 0.20.0 (August 2023)
- 0.19.0 (August 2023)
- 0.18.0 (July 2023)
- 0.17.0 (June 2023)
- 0.16.0 (May 2023)
- 0.15.0 (April 2023)
- 0.14.0 (March 2023)
- 0.13.0 (January 2023)
- 0.12.0 (December 2022)
- 0.11.0 (November 2022)
- 0.10.0 (November 2022)
- 0.9.0 (October 2022)
- 0.8.0 (September 2022)
- 0.7.0 (August 2022)
- 0.6.0 (July 2022)
- 0.5.0 (July 2022)
- 0.4.0 (June 2022)
- 0.3.1 (May 2022)
- 0.3.0 (May 2022)
- 0.2.0 (April 2022)
- 0.1.2 (April 2022)
- 0.1.1 (March 2022)
- 0.1.0 (March 2022)
Useful links