Skip to content

Commit

Permalink
Merge pull request #194 from BQSKit/pre-built-model-example
Browse files Browse the repository at this point in the history
Pre built model example
  • Loading branch information
edyounis authored Oct 17, 2023
2 parents 6654a0f + c6f1c8e commit 0044416
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 3 deletions.
9 changes: 9 additions & 0 deletions bqskit/compiler/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ def compile(
>>> model = MachineModel(circuit.num_qudits, gate_set=target_gate_set)
>>> compiled_circuit = compile(circuit, model, optimization_level=2)
You can also use pre-built models from the :obj:`~bqskit.ext` package
for common hardware. For example, to compile to the H1-1 machine
from Quantinuum:
>>> from bqskit import compile, Circuit
>>> from bqskit.ext import H1_1Model
>>> circuit = Circuit.from_file('input.qasm')
>>> compiled_circuit = compile(circuit, H1_1Model)
Raises:
ValueError: If the input is an empty iterable.
Expand Down
4 changes: 2 additions & 2 deletions bqskit/compiler/machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def __init__(
ValueError: If `num_qudits` is nonpositive.
Note:
Pre-built models for many active QPUs exist in the `bqskit.ext`
package.
Pre-built models for many active QPUs exist in the
:obj:`~bqskit.ext` package.
"""

if not is_integer(num_qudits):
Expand Down
45 changes: 44 additions & 1 deletion bqskit/ext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,50 @@
.. currentmodule:: bqskit.ext
This subpackage provides integrations with other popular frameworks
and pre-built MachineModels for many QPUs.
and pre-built MachineModels for many QPUs. For some, you will need to
manually install the dependencies. For example, to use the Pytket translators
you will need to install the `pytket` package.
.. rubric:: Pre-Built Machine Models
.. autosummary::
:toctree: autogen
:recursive:
Aspen11Model
AspenM2Model
H1_1Model
H1_2Model
Sycamore23Model
SycamoreModel
model_from_backend
.. rubric:: Translators
.. autosummary::
:toctree: autogen
:recursive:
bqskit_to_cirq
cirq_to_bqskit
bqskit_to_pytket
pytket_to_bqskit
bqskit_to_qiskit
qiskit_to_bqskit
bqskit_to_qutip
qutip_to_bqskit
.. rubric:: SupermarQ Metrics
.. autosummary::
:toctree: autogen
:recursive:
supermarq_program_communication
supermarq_critical_depth
supermarq_entanglement_ratio
supermarq_parallelism
supermarq_liveness
"""
from __future__ import annotations

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ our `tutorial series. <https://github.com/BQSKit/bqskit-tutorial/>`_
source/utils
source/exec
source/runtime
source/ext
4 changes: 4 additions & 0 deletions docs/source/ext.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: bqskit.ext
:no-members:
:no-inherited-members:
:no-special-members:

0 comments on commit 0044416

Please sign in to comment.