Skip to content

Commit

Permalink
Improve header hierarchy for API module pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed May 1, 2024
1 parent a41690d commit 6b3d486
Show file tree
Hide file tree
Showing 15 changed files with 128 additions and 151 deletions.
16 changes: 5 additions & 11 deletions qiskit/assembler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,19 @@
Circuit and Schedule Assembler (:mod:`qiskit.assembler`)
========================================================
.. currentmodule:: qiskit.assembler
Functions
=========
Circuit Assembler
=================
.. currentmodule:: qiskit.assembler
.. autofunction:: assemble_circuits
Schedule Assembler
==================
.. autofunction:: assemble_schedules
Disassembler
============
.. autofunction:: disassemble
RunConfig
=========
Classes
=======
.. autosummary::
:toctree: ../stubs/
Expand Down
4 changes: 2 additions & 2 deletions qiskit/circuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@
.. _circuit-module-api:
API overview of :mod:`qiskit.circuit`
=====================================
API overview of qiskit.circuit
==============================
All objects here are described in more detail, and in their greater context in the following
sections. This section provides an overview of the API elements documented here.
Expand Down
9 changes: 5 additions & 4 deletions qiskit/circuit/classical/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@
Working with types
==================
There are some functions on these types exposed here as well. These are mostly expected to be used
only in manipulations of the expression tree; users who are building expressions using the
There are some additional functions on these types documented in the subsequent sections.
These are mostly expected to be used only in manipulations of the expression tree;
users who are building expressions using the
:ref:`user-facing construction interface <circuit-classical-expressions-expr-construction>` should
not need to use these.
Partial ordering of types
-------------------------
=========================
The type system is equipped with a partial ordering, where :math:`a < b` is interpreted as
":math:`a` is a strict subtype of :math:`b`". Note that the partial ordering is a subset of the
Expand All @@ -78,7 +79,7 @@
Casting between types
---------------------
=====================
It is common to need to cast values of one type to another type. The casting rules for this are
embedded into the :mod:`types` module. You can query the casting kinds using :func:`cast_kind`:
Expand Down
1 change: 1 addition & 0 deletions qiskit/circuit/classicalfunction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def grover_oracle(a: Int1, b: Int1, c: Int1, d: Int1) -> Int1:
Decorator for a classical function that returns a `ClassicalFunction` object.
.. autofunction:: classical_function
ClassicalFunction
-----------------
Expand Down
22 changes: 3 additions & 19 deletions qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,35 +129,19 @@
Standard Directives
===================
..
This summary table deliberately does not generate toctree entries; these directives are "owned"
by ``qiskit.circuit``.
Directives are operations to the quantum stack that are meant to be interpreted by the backend or
the transpiler. In general, the transpiler or backend might optionally ignore them if there is no
implementation for them.
..
This summary table deliberately does not generate toctree entries; these directives are "owned"
by ``qiskit.circuit``.
.. autosummary::
Barrier
* :class:`qiskit.circuit.Barrier`
Standard Operations
===================
Operations are non-reversible changes in the quantum state of the circuit.
..
This summary table deliberately does not generate toctree entries; these directives are "owned"
by ``qiskit.circuit``.
.. autosummary::
Measure
Reset
* :class:`qiskit.circuit.Measure`
* :class:`qiskit.circuit.Reset`
Generalized Gates
=================
Expand Down
19 changes: 17 additions & 2 deletions qiskit/converters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,27 @@
.. currentmodule:: qiskit.converters
.. autofunction:: circuit_to_dag
.. autofunction:: dag_to_circuit
QuantumCircuit
==============
.. autofunction:: circuit_to_instruction
.. autofunction:: circuit_to_gate
QuantumCircuit <> DagCircuit
============================
.. autofunction:: circuit_to_dag
.. autofunction:: dag_to_circuit
QuantumCircuit <> DagDependency
===============================
.. autofunction:: dagdependency_to_circuit
.. autofunction:: circuit_to_dagdependency
DagCircuit <> DagDependency
===========================
.. autofunction:: dag_to_dagdependency
.. autofunction:: dagdependency_to_dag
"""
Expand Down
29 changes: 12 additions & 17 deletions qiskit/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@
.. autoexception:: JobTimeoutError
.. autoexception:: BackendConfigurationError
=====================
Writing a New Backend
=====================
Expand Down Expand Up @@ -164,7 +163,7 @@
`qiskit-aqt-provider <https://github.com/Qiskit-Partners/qiskit-aqt-provider>`__
Provider
========
--------
A provider class serves a single purpose: to get backend objects that enable
executing circuits on a device or simulator. The expectation is that any
Expand Down Expand Up @@ -195,7 +194,7 @@ def backends(self, name=None, **kwargs):
method matches the required interface. The rest is up to the specific provider on how to implement.
Backend
=======
-------
The backend classes are the core to the provider. These classes are what
provide the interface between Qiskit and the hardware or simulator that will
Expand Down Expand Up @@ -276,8 +275,8 @@ def run(circuits, **kwargs):
return MyJob(self. job_handle, job_json, circuit)
Transpiler Interface
--------------------
Backend's Transpiler Interface
------------------------------
The key piece of the :class:`~qiskit.providers.Backend` object is how it describes itself to the
compiler. This is handled with the :class:`~qiskit.transpiler.Target` class which defines
Expand Down Expand Up @@ -453,8 +452,8 @@ def get_translation_stage_plugin(self):
efficient output on ``Mybackend`` the transpiler will be able to perform these
custom steps without any manual user input.
Run Method
----------
Backend's.run Method
--------------------
Of key importance is the :meth:`~qiskit.providers.BackendV2.run` method, which
is used to actually submit circuits to a device or simulator. The run method
Expand Down Expand Up @@ -484,8 +483,8 @@ def run(self, circuits. **kwargs):
job_handle = submit_to_backend(job_jsonb)
return MyJob(self. job_handle, job_json, circuit)
Options
-------
Backend Options
---------------
There are often several options for a backend that control how a circuit is run.
The typical example of this is something like the number of ``shots`` which is
Expand Down Expand Up @@ -515,7 +514,7 @@ def _default_options(cls):
Job
===
---
The output from the :obj:`~qiskit.providers.BackendV2.run` method is a :class:`~qiskit.providers.JobV1`
object. Each provider is expected to implement a custom job subclass that
Expand Down Expand Up @@ -612,7 +611,7 @@ def status(self):
return JobStatus.DONE
Primitives
==========
----------
While not directly part of the provider interface, the :mod:`qiskit.primitives`
module is tightly coupled with providers. Specifically the primitive
Expand Down Expand Up @@ -640,12 +639,8 @@ def status(self):
:class:`~.Estimator`, :class:`~.BackendSampler`, and :class:`~.BackendEstimator`
can serve as references/models on how to implement these as well.
======================================
Migrating between Backend API Versions
======================================
BackendV1 -> BackendV2
======================
Migrating from BackendV1 to BackendV2
=====================================
The :obj:`~BackendV2` class re-defined user access for most properties of a
backend to make them work with native Qiskit data structures and have flatter
Expand Down
23 changes: 1 addition & 22 deletions qiskit/providers/basic_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,15 @@
backend = BasicProvider().get_backend('basic_simulator')
Simulators
Classes
==========
.. autosummary::
:toctree: ../stubs/
BasicSimulator
Provider
========
.. autosummary::
:toctree: ../stubs/
BasicProvider
Job Class
=========
.. autosummary::
:toctree: ../stubs/
BasicProviderJob
Exceptions
==========
.. autosummary::
:toctree: ../stubs/
BasicProviderError
"""

Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
useful for testing the transpiler and other backend-facing functionality.
Example Usage
=============
-------------
Here is an example of using a simulated backend for transpilation and running.
Expand Down
4 changes: 2 additions & 2 deletions qiskit/providers/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
Qiskit schema-conformant objects used by the backends and providers.
Backend Objects
===============
Classes
=======
.. autosummary::
:toctree: ../stubs/
Expand Down
Loading

0 comments on commit 6b3d486

Please sign in to comment.