You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/intro.txt
+38-15
Original file line number
Diff line number
Diff line change
@@ -16,13 +16,36 @@ Windows. To install, run:
16
16
17
17
pip install pytket-qiskit
18
18
19
-
This will install `pytket` if it isn't already installed, and add new classes
20
-
and methods into the `pytket.extensions` namespace.
19
+
This will install ``pytket`` if it isn't already installed, and add new classes
20
+
and methods into the ``pytket.extensions`` namespace.
21
+
22
+
An example using the shots-based :py:class:`AerBackend` simulator is shown below.
23
+
24
+
::
25
+
26
+
from pytket.extensions.qiskit import AerBackend
27
+
28
+
backend = AerBackend()
29
+
circ = Circuit(2).H(0).CX(0, 1).measure_all()
30
+
31
+
# Compilation not needed here as both H and CX are supported gates
32
+
result = backend.run_circuit(circ, n_shots=1000)
33
+
34
+
This simulator supports a large set of gates and by default has no architectural constraints or quantum noise. However the user can pass in a noise model or custom architecture to more closely model a real quantum device.
35
+
36
+
The :py:class:`AerBackend` also supports GPU simulation which can be configured as follows.
37
+
38
+
::
39
+
40
+
from pytket.extensions.qiskit import AerBackend
41
+
42
+
backend = AerBackend()
43
+
backend._backend.set_option("device", "GPU")
21
44
22
45
Access and Credentials
23
46
======================
24
47
25
-
Accessing devices and simulators through the pytket-qiskit extension requires an IBMQ account. An account can be set up here -> https://quantum-computing.ibm.com/login.
48
+
With the exception of the Aer simulators, accessing devices and simulators through the ``pytket-qiskit`` extension requires an IBMQ account. An account can be set up here: https://quantum-computing.ibm.com/login.
26
49
27
50
Once you have created an account you can obtain an API token which you can use to configure your credentials locally.
28
51
@@ -32,7 +55,7 @@ Once you have created an account you can obtain an API token which you can use t
32
55
33
56
set_ibmq_config(ibmq_api_token=ibm_token)
34
57
35
-
This will save your IBMQ credentials locally. After saving your credentials you can access pytket-qiskit backend repeatedly without having to re-initialise your credentials.
58
+
This will save your IBMQ credentials locally. After saving your credentials you can access ``pytket-qiskit`` backend repeatedly without having to re-initialise your credentials.
36
59
37
60
If you are a member of an IBM hub then you can add this information to ``set_ibmq_config`` as well.
38
61
@@ -53,7 +76,7 @@ locally without saving the token in pytket config:
To see which devices you can access you can use the ``available_devices`` method on the ``IBMQBackend`` or ``IBMQEmulatorBackend``. Note that it is possible to pass ``hub``, ``group`` and ``project`` parameters to this method. This allows you to see which devices are accessible through your IBM hub.
79
+
To see which devices you can access you can use the ``available_devices`` method on the :py:class:`IBMQBackend` or :py:class:`IBMQEmulatorBackend`. Note that it is possible to pass ``hub``, ``group`` and ``project`` parameters to this method. This allows you to see which devices are accessible through your IBM hub.
57
80
58
81
::
59
82
@@ -66,7 +89,7 @@ To see which devices you can access you can use the ``available_devices`` method
66
89
Backends Available Through pytket-qiskit
67
90
========================================
68
91
69
-
The ``pytket-qiskit`` extension has several types of available ``Backend``. These are the ``IBMQBackend``
92
+
The ``pytket-qiskit`` extension has several types of available :py:class:`Backend`. These are the :py:class:`IBMQBackend`
70
93
and several types of simulator.
71
94
72
95
.. list-table::
@@ -86,13 +109,13 @@ and several types of simulator.
* [1] ``AerBackend`` is noiseless by default and has no architecture. However it can accept a user defined ``NoiseModel`` and ``Architecture``.
90
-
* In addition to the backends above the pytket-qiskit extension also has the ``TketBackend``. This allows a tket ``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.
112
+
* [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`.
113
+
* 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.
91
114
92
115
Default Compilation
93
116
===================
94
117
95
-
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 passes applied by different levels of optimisation are specified in the table below.
118
+
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.
96
119
97
120
.. list-table:: **Default compilation pass for the IBMQBackend and IBMQEmulatorBackend**
98
121
:widths: 25 25 25
@@ -134,24 +157,24 @@ Every ``Backend`` in pytket has its own ``default_compilation_pass`` method. Thi
134
157
135
158
* [1] If no value is specified then ``optimisation_level`` defaults to a value of 2.
136
159
* [2] self.rebase_pass is a rebase to the gateset supported by the backend, For IBM quantum devices that is {X, SX, Rz, CX}.
137
-
* [3] Here ``CXMappingPass`` maps program qubits to the architecture using a `NoiseAwarePlacement <https://cqcl.github.io/tket/pytket/api/placement.html#pytket.placement.NoiseAwarePlacement>`_
138
-
* [4] ``SimplifyInitial`` has arguments ``allow_classical=False`` and ``create_all_qubits=True``.
160
+
* [3] Here :py:class:`CXMappingPass` maps program qubits to the architecture using a `NoiseAwarePlacement <https://cqcl.github.io/tket/pytket/api/placement.html#pytket.placement.NoiseAwarePlacement>`_
161
+
* [4] :py:class:`SimplifyInitial` has arguments ``allow_classical=False`` and ``create_all_qubits=True``.
139
162
140
163
141
-
**Note:** The ``default_compilation_pass`` for ``AerBackend`` is the same as above except it doesn't use ``SimplifyInitial``.
164
+
**Note:** The ``default_compilation_pass`` for :py:class:`AerBackend` is the same as above except it doesn't use :py:class:`SimplifyInitial`.
142
165
143
166
144
167
Backend Predicates
145
168
==================
146
169
147
170
Circuits must satisfy certain conditions before they can be processed on a device or simulator. In pytket these conditions are called predicates.
148
171
149
-
All pytket-qiskit backends have the following two predicates.
172
+
All ``pytket-qiskit`` backends have the following two predicates.
150
173
151
-
* `GateSetPredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.GateSetPredicate>`_ - The circuit must contain only operations supported by the ``Backend``. To view supported Ops run ``BACKENDNAME.backend_info.gate_set``.
174
+
* `GateSetPredicate <https://cqcl.github.io/tket/pytket/api/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``.
152
175
* `NoSymbolsPredicate <https://cqcl.github.io/tket/pytket/api/predicates.html#pytket.predicates.NoSymbolsPredicate>`_ - Parameterised gates must have numerical values when the circuit is executed.
153
176
154
-
The ``IBMQBackend`` and ``IBMQEmulatorBackend`` may also have the following predicates depending on the capabilities of the specified device.
177
+
The :py:class:`IBMQBackend` and :py:class:`IBMQEmulatorBackend` may also have the following predicates depending on the capabilities of the specified device.
0 commit comments