Skip to content

Commit 3f3b95c

Browse files
authored
Merge pull request #289 from CQCL/release/0.49.0
release 0.49.0
2 parents f488dc9 + 366ce0e commit 3f3b95c

19 files changed

+540
-230
lines changed

.github/workflows/build_and_test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,4 @@ jobs:
159159
steps:
160160
- name: Deploy to GitHub Pages
161161
id: deployment
162-
uses: actions/deploy-pages@v4.0.3
162+
uses: actions/deploy-pages@v4.0.4

_metadata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__extension_version__ = "0.48.1rc1"
1+
__extension_version__ = "0.49.0"
22
__extension_name__ = "pytket-qiskit"

docs/api.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ API documentation
1111
:show-inheritance:
1212
:members:
1313

14-
.. autoclass:: pytket.extensions.qiskit.AerBackend
14+
.. autoclass:: pytket.extensions.qiskit.IBMQLocalEmulatorBackend
1515
:special-members: __init__
1616
:show-inheritance:
17+
:members:
18+
19+
.. autoclass:: pytket.extensions.qiskit.AerBackend
20+
:special-members: __init__
1721
:inherited-members:
1822
:members:
1923

2024
.. autoclass:: pytket.extensions.qiskit.AerStateBackend
2125
:special-members: __init__
2226
:inherited-members:
23-
:show-inheritance:
2427
:members:
2528

2629
.. autoclass:: pytket.extensions.qiskit.AerUnitaryBackend
2730
:special-members: __init__
28-
:show-inheritance:
2931
:inherited-members:
3032
:members:
3133

docs/changelog.rst

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
~~~~~~~~~
33

4+
0.49.0 (March 2024)
5+
-------------------
6+
7+
* Update pytket version requirement to 1.25.
8+
* Update qiskit version requirement to 1.0.
9+
* Update qiskit-ibm-provider version requirement to 0.10.
10+
* Update qiskit-ibm-runtime version requirement to 0.21.
11+
* Add ``IBMQLocalEmulatorBackend`` for running local emulation of
12+
``IBMQBackend`` using ``AerBackend`` with a noise model.
13+
414
0.48.1rc1
515
---------
616

docs/intro.txt

+99-57
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pytket-qiskit
2-
==================================
2+
#############
33

4-
IBM's `Qiskit <https://qiskit.org>`_ is an open-source framework for quantum
4+
IBM's `Qiskit <https://www.ibm.com/quantum/qiskit>`_ is an open-source framework for quantum
55
computation, ranging from high-level algorithms to low-level circuit
66
representations, simulation and access to the `IBMQ <https://www.research.ibm.com/ibm-q/>`_ Experience devices.
77

@@ -19,6 +19,22 @@ Windows. To install, run:
1919
This will install ``pytket`` if it isn't already installed, and add new classes
2020
and methods into the ``pytket.extensions`` namespace.
2121

22+
Available IBM Backends
23+
======================
24+
25+
.. currentmodule:: pytket.extensions.qiskit
26+
27+
.. autosummary::
28+
:nosignatures:
29+
30+
IBMQBackend
31+
IBMQEmulatorBackend
32+
IBMQLocalEmulatorBackend
33+
AerBackend
34+
AerStateBackend
35+
AerUnitaryBackend
36+
37+
2238
An example using the shots-based :py:class:`AerBackend` simulator is shown below.
2339

2440
::
@@ -65,28 +81,11 @@ In this section we are assuming that you have set the following variables with t
6581
group = '<your_group_here>'
6682
project = '<your_project_here>'
6783

68-
.. note:: The documentation below is correct as of pytket-qiskit version 0.40.0 and newer. In the 0.40.0 release pytket-qiskit moved to using the `qiskit-ibm-provider <https://qiskit.org/ecosystem/ibm-provider/tutorials/Migration_Guide_from_qiskit-ibmq-provider.html>`_. In pytket-qiskit versions 0.39.0 and older the parameters ``hub``, ``group`` and ``project`` were handled separately instead of a single ``instance`` string as in 0.40.0 and newer.
69-
70-
::
71-
72-
from pytket.extensions.qiskit import set_ibmq_config
73-
74-
set_ibmq_config(ibmq_api_token=ibm_token)
75-
76-
After saving your credentials you can access ``pytket-qiskit`` backend repeatedly without having to re-initialise your credentials.
77-
78-
If you are a member of an IBM hub then you can add this information to ``set_ibmq_config`` as well.
79-
80-
::
81-
82-
from pytket.extensions.qiskit import set_ibmq_config
83-
84-
set_ibmq_config(ibmq_api_token=ibm_token, instance=f"{hub}/{group}/{project}")
85-
86-
Alternatively you can use the following qiskit commands to save your credentials
87-
locally without saving the token in pytket config:
84+
Method 1: Using :py:class:`IBMProvider`
85+
---------------------------------------
8886

89-
.. note:: If using pytket-qiskit 0.39.0 or older you will have to use the deprecated :py:meth:`IBMQ.save_account` instead of :py:meth:`IBMProvider.save_account` in the code below.
87+
You can use the following qiskit commands to save your IBM credentials
88+
to disk:
9089

9190
::
9291

@@ -106,42 +105,62 @@ To see which devices you can access you can use the ``available_devices`` method
106105
my_instance=f"{hub}/{group}/{project}"
107106
ibm_provider = IBMProvider(instance=my_instance)
108107
backend = IBMQBackend("ibmq_nairobi") # Initialise backend for an IBM device
108+
109109
backendinfo_list = backend.available_devices(instance=my_instance, provider=ibm_provider)
110110
print([backend.device_name for backend in backendinfo_list])
111111

112112

113-
Backends Available Through pytket-qiskit
114-
========================================
115113

116-
The ``pytket-qiskit`` extension has several types of available :py:class:`Backend`. These are the :py:class:`IBMQBackend`
117-
and several types of simulator.
114+
Method 2: Saving credentials in a local pytket config file
115+
----------------------------------------------------------
116+
Alternatively, you can store your credentials in local pytket config using the :py:meth:`set_ibmq_config` method.
118117

119-
.. list-table::
120-
:widths: 25 25
121-
:header-rows: 1
118+
::
119+
120+
from pytket.extensions.qiskit import set_ibmq_config
121+
122+
set_ibmq_config(ibmq_api_token=ibm_token)
123+
124+
After saving your credentials you can access ``pytket-qiskit`` backend repeatedly without having to re-initialise your credentials.
125+
126+
If you are a member of an IBM hub then you can add this information to ``set_ibmq_config`` as well.
127+
128+
::
129+
130+
from pytket.extensions.qiskit import set_ibmq_config
131+
132+
set_ibmq_config(ibmq_api_token=ibm_token, instance=f"{hub}/{group}/{project}")
133+
134+
.. currentmodule:: pytket.extensions.qiskit.backends.config
135+
136+
.. autosummary::
137+
:nosignatures:
138+
139+
QiskitConfig
140+
set_ibmq_config
141+
142+
Converting circuits between pytket and qiskit
143+
=============================================
144+
145+
Users may wish to port quantum circuits between pytket and qiskit. This allows the features of both libraries to be used.
146+
For instance those familiar with qiskit may wish to convert their circuits to pytket and use the available compilation passes to optimise circuits.
147+
148+
.. currentmodule:: pytket.extensions.qiskit
149+
150+
151+
.. autosummary::
152+
:nosignatures:
153+
154+
qiskit_to_tk
155+
tk_to_qiskit
122156

123-
* - Backend
124-
- Type
125-
* - `IBMQBackend <https://tket.quantinuum.com/extensions/pytket-qiskit/api/api.html#pytket.extensions.qiskit.IBMQBackend>`_
126-
- Interface to an IBM quantum computer.
127-
* - `IBMQEmulatorBackend <https://tket.quantinuum.com/extensions/pytket-qiskit/api/api.html#pytket.extensions.qiskit.IBMQEmulatorBackend>`_
128-
- Emulator for a chosen ``IBMBackend`` (Device specific).
129-
* - `AerBackend <https://tket.quantinuum.com/extensions/pytket-qiskit/api/api.html#pytket.extensions.qiskit.AerBackend>`_
130-
- A noiseless, shots-based simulator for quantum circuits [1]
131-
* - `AerStateBackend <https://tket.quantinuum.com/extensions/pytket-qiskit/api/api.html#pytket.extensions.qiskit.AerStateBackend>`_
132-
- Statevector simulator.
133-
* - `AerUnitaryBackend <https://tket.quantinuum.com/extensions/pytket-qiskit/api/api.html#pytket.extensions.qiskit.AerUnitaryBackend>`_
134-
- Unitary simulator
135-
136-
* [1] :py:class:`AerBackend` is noiseless by default and has no architecture. However it can accept a user defined :py:class:`NoiseModel` and :py:class:`Architecture`.
137-
* In addition to the backends above the ``pytket-qiskit`` extension also has the :py:class:`TketBackend`. This allows a tket :py:class:`Backend` to be used directly through qiskit. see the `notebook example <https://github.com/CQCL/pytket/blob/main/examples/qiskit_integration.ipynb>`_ on qiskit integration.
138157

139158
Default Compilation
140159
===================
141160

142161
Every :py:class:`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 :py:class:`Backend`. The passes applied by different levels of optimisation are specified in the table below.
143162

144-
.. list-table:: **Default compilation pass for the IBMQBackend and IBMQEmulatorBackend**
163+
.. list-table:: **Default compilation pass for the IBMQBackend, IBMQEmulatorBackend and IBMQLocalEmulatorBackend**
145164
:widths: 25 25 25
146165
:header-rows: 1
147166

@@ -177,28 +196,51 @@ Every :py:class:`Backend` in pytket has its own ``default_compilation_pass`` met
177196
- `RemoveRedundancies <https://tket.quantinuum.com/api-docs/passes.html#pytket.passes.RemoveRedundancies>`_
178197

179198
* [1] If no value is specified then ``optimisation_level`` defaults to a value of 2.
180-
* [2] self.rebase_pass is a rebase to the gateset supported by the backend, For IBM quantum devices that is {X, SX, Rz, CX}.
199+
* [2] self.rebase_pass is a rebase to the gateset supported by the backend. For IBM quantum devices and emulators that is either {X, SX, Rz, CX} or {X, SX, Rz, ECR}. The more idealised Aer simulators have a much broader range of supported gates.
181200
* [3] Here :py:class:`CXMappingPass` maps program qubits to the architecture using a `NoiseAwarePlacement <https://tket.quantinuum.com/api-docs/placement.html#pytket.placement.NoiseAwarePlacement>`_
182201

183202

184203
**Note:** The ``default_compilation_pass`` for :py:class:`AerBackend` is the same as above.
185204

186205

187-
Backend Predicates
188-
==================
206+
Noise Modelling
207+
===============
208+
209+
.. currentmodule:: pytket.extensions.qiskit.backends.crosstalk_model
210+
211+
.. autosummary::
212+
:nosignatures:
213+
214+
CrosstalkParams
215+
216+
217+
Using TKET directly on qiskit circuits
218+
======================================
219+
220+
For usage of :py:class:`TketBackend` see the `qiskit integration notebook example <https://tket.quantinuum.com/examples/qiskit_integration.html>`_.
221+
222+
.. currentmodule:: pytket.extensions.qiskit.tket_backend
223+
224+
.. autosummary::
225+
:nosignatures:
226+
227+
TketBackend
228+
229+
.. currentmodule:: pytket.extensions.qiskit.tket_pass
230+
231+
.. autosummary::
232+
:nosignatures:
189233

190-
Circuits must satisfy certain conditions before they can be processed on a device or simulator. In pytket these conditions are called predicates.
234+
TketPass
235+
TketAutoPass
191236

192-
All ``pytket-qiskit`` backends have the following two predicates.
237+
.. currentmodule:: pytket.extensions.qiskit.tket_job
193238

194-
* `GateSetPredicate <https://tket.quantinuum.com/api-docs/predicates.html#pytket.predicates.GateSetPredicate>`_ - The circuit must contain only operations supported by the :py:class`Backend`. To view supported Ops run ``BACKENDNAME.backend_info.gate_set``.
195-
* `NoSymbolsPredicate <https://tket.quantinuum.com/api-docs/predicates.html#pytket.predicates.NoSymbolsPredicate>`_ - Parameterised gates must have numerical values when the circuit is executed.
239+
.. autosummary::
240+
:nosignatures:
196241

197-
The :py:class:`IBMQBackend` and :py:class:`IBMQEmulatorBackend` may also have the following predicates depending on the capabilities of the specified device.
242+
TketJob
198243

199-
* `NoClassicalControlPredicate <https://tket.quantinuum.com/api-docs/predicates.html#pytket.predicates.NoClassicalControlPredicate>`_
200-
* `NoMidMeasurePredicate <https://tket.quantinuum.com/api-docs/predicates.html#pytket.predicates.NoMidMeasurePredicatePredicate>`_
201-
* `NoFastFeedforwardPredicate <https://tket.quantinuum.com/api-docs/predicates.html#pytket.predicates.NoFastFeedforwardPredicate>`_
202244

203245
.. toctree::
204246
api.rst

pytket/extensions/qiskit/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
AerStateBackend,
2323
AerUnitaryBackend,
2424
IBMQEmulatorBackend,
25+
IBMQLocalEmulatorBackend,
2526
)
2627
from .backends.config import set_ibmq_config
2728
from .qiskit_convert import qiskit_to_tk, tk_to_qiskit, process_characterisation

pytket/extensions/qiskit/backends/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
from .ibm import IBMQBackend, NoIBMQCredentialsError
1717
from .aer import AerBackend, AerStateBackend, AerUnitaryBackend
1818
from .ibmq_emulator import IBMQEmulatorBackend
19+
from .ibmq_local_emulator import IBMQLocalEmulatorBackend

0 commit comments

Comments
 (0)