Skip to content

Commit

Permalink
Reorganize API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Arellano committed Oct 28, 2024
1 parent f622409 commit 957bbf8
Show file tree
Hide file tree
Showing 23 changed files with 225 additions and 195 deletions.
38 changes: 14 additions & 24 deletions docs/apidocs/index.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
.. qiskit_addon_cutting:
======================================
``qiskit-addon-cutting`` API reference
======================================

.. module:: qiskit_addon_cutting
.. toctree::
:maxdepth: 1

==============
API References
==============

###############
Circuit Cutting
###############

.. automodule:: qiskit_addon_cutting
:no-index:
:no-members:
:no-inherited-members:
:no-special-members:

#########
Utilities
#########

.. automodule:: qiskit_addon_cutting.utils
:no-members:
:no-inherited-members:
:no-special-members:
qiskit_addon_cutting
qiskit_addon_cutting.instructions
qiskit_addon_cutting.qpd
qiskit_addon_cutting.utils.bitwise
qiskit_addon_cutting.utils.iteration
qiskit_addon_cutting.utils.observable_grouping
qiskit_addon_cutting.utils.simulation
qiskit_addon_cutting.utils.transforms
qiskit_addon_cutting.utils.transpiler_passes
13 changes: 13 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.instructions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=======================================================
Instructions (:mod:`qiskit_addon_cutting.instructions`)
=======================================================

.. automodule:: qiskit_addon_cutting.instructions
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.instructions

.. autoclass:: CutWire
.. autoclass:: Move
20 changes: 20 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.qpd.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=======================================================================
Quasi-Probability Decomposition (QPD) (:mod:`qiskit_addon_cutting.qpd`)
=======================================================================

.. automodule:: qiskit_addon_cutting.qpd
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.qpd

.. autoclass:: QPDBasis
.. autoclass:: BaseQPDGate
.. autoclass:: SingleQubitQPDGate
.. autoclass:: TwoQubitQPDGate
.. autoclass:: WeightType

.. autofunction:: generate_qpd_weights
.. autofunction:: decompose_qpd_instructions
.. autofunction:: qpdbasis_from_instruction
28 changes: 28 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=============================================
Circuit cutting (:mod:`qiskit_addon_cutting`)
=============================================

.. automodule:: qiskit_addon_cutting
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting

.. autofunction:: cut_wires
.. autofunction:: expand_observables
.. autofunction:: partition_circuit_qubits
.. autofunction:: partition_problem
.. autofunction:: cut_gates
.. autofunction:: generate_cutting_experiments
.. autofunction:: reconstruct_expectation_values

.. autoclass:: PartitionedCuttingProblem

Automatic Cut Finding
~~~~~~~~~~~~~~~~~~~~~

.. autofunction:: find_cuts

.. autoclass:: OptimizationParameters
.. autoclass:: DeviceConstraints
12 changes: 12 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.utils.bitwise.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
=============================================================
Bitwise utilities (:mod:`qiskit_addon_cutting.utils.bitwise`)
=============================================================

.. automodule:: qiskit_addon_cutting.utils.bitwise
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.utils.bitwise

.. autofunction:: bit_count
13 changes: 13 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.utils.iteration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=================================================================
Iteration utilities (:mod:`qiskit_addon_cutting.utils.iteration`)
=================================================================

.. automodule:: qiskit_addon_cutting.utils.iteration
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.utils.iteration

.. autofunction:: unique_by_id
.. autofunction:: unique_by_eq
14 changes: 14 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.utils.observable_grouping.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
===========================================================================
Observable grouping (:mod:`qiskit_addon_cutting.utils.observable_grouping`)
===========================================================================

.. automodule:: qiskit_addon_cutting.utils.observable_grouping
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.utils.observable_grouping

.. autofunction:: observables_restricted_to_subsystem
.. autoclass:: CommutingObservableGroup
.. autoclass:: ObservableCollection
13 changes: 13 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.utils.simulation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
===================================================================
Simulation utilities (:mod:`qiskit_addon_cutting.utils.simulation`)
===================================================================

.. automodule:: qiskit_addon_cutting.utils.simulation
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.utils.simulation

.. autofunction:: simulate_statevector_outcomes
.. autoclass:: ExactSampler
13 changes: 13 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.utils.transforms.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=========================================================
Transforms (:mod:`qiskit_addon_cutting.utils.transforms`)
=========================================================

.. automodule:: qiskit_addon_cutting.utils.transforms
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.utils.transforms

.. autofunction:: separate_circuit
.. autoclass:: SeparatedCircuits
13 changes: 13 additions & 0 deletions docs/apidocs/qiskit_addon_cutting.utils.transpiler_passes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=======================================================================
Transpiler passes (:mod:`qiskit_addon_cutting.utils.transpiler_passes`)
=======================================================================

.. automodule:: qiskit_addon_cutting.utils.transpiler_passes
:no-members:
:no-inherited-members:
:no-special-members:

.. currentmodule:: qiskit_addon_cutting.utils.transpiler_passes

.. autoclass:: RemoveFinalReset
.. autoclass:: ConsolidateResets
51 changes: 48 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
plot_html_show_formats = False
plot_formats = ["svg"]

# Redirects for pages that have moved
redirects = {}

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
Expand All @@ -119,6 +116,54 @@
"rustworkx": ("https://www.rustworkx.org/", None),
}

# ----------------------------------------------------------------------------------
# Redirects
# ----------------------------------------------------------------------------------

_inlined_apis = [
("qiskit_addon_cutting", "cut_wires"),
("qiskit_addon_cutting", "expand_observables"),
("qiskit_addon_cutting", "partition_circuit_qubits"),
("qiskit_addon_cutting", "partition_problem"),
("qiskit_addon_cutting", "cut_gates"),
("qiskit_addon_cutting", "generate_cutting_experiments"),
("qiskit_addon_cutting", "reconstruct_expectation_values"),
("qiskit_addon_cutting", "PartitionedCuttingProblem"),
("qiskit_addon_cutting", "find_cuts"),
("qiskit_addon_cutting", "OptimizationParameters"),
("qiskit_addon_cutting", "DeviceConstraints"),
("qiskit_addon_cutting.instructions", "CutWire"),
("qiskit_addon_cutting.instructions", "Move"),
("qiskit_addon_cutting.qpd", "QPDBasis"),
("qiskit_addon_cutting.qpd", "BaseQPDGate"),
("qiskit_addon_cutting.qpd", "SingleQubitQPDGate"),
("qiskit_addon_cutting.qpd", "TwoQubitQPDGate"),
("qiskit_addon_cutting.qpd", "WeightType"),
("qiskit_addon_cutting.qpd", "generate_qpd_weights"),
("qiskit_addon_cutting.qpd", "decompose_qpd_instructions"),
("qiskit_addon_cutting.qpd", "qpdbasis_from_instruction"),
("qiskit_addon_cutting.utils.bitwise", "bit_count"),
("qiskit_addon_cutting.utils.iteration", "unique_by_id"),
("qiskit_addon_cutting.utils.iteration", "unique_by_eq"),
(
"qiskit_addon_cutting.utils.observable_grouping",
"observables_restricted_to_subsystem",
),
("qiskit_addon_cutting.utils.observable_grouping", "CommutingObservableGroup"),
("qiskit_addon_cutting.utils.observable_grouping", "ObservableCollection"),
("qiskit_addon_cutting.utils.simulation", "simulate_statevector_outcomes"),
("qiskit_addon_cutting.utils.simulation", "ExactSampler"),
("qiskit_addon_cutting.utils.transforms", "separate_circuit"),
("qiskit_addon_cutting.utils.transforms", "SeparatedCircuits"),
("qiskit_addon_cutting.utils.transpiler_passes", "RemoveFinalReset"),
("qiskit_addon_cutting.utils.transpiler_passes", "ConsolidateResets"),
]

redirects = {
f"stubs/{module}.{name}": f"../apidocs/{module}.html#{module}.{name}"
for module, name in _inlined_apis
}

# ----------------------------------------------------------------------------------
# Source code links
# ----------------------------------------------------------------------------------
Expand Down
68 changes: 1 addition & 67 deletions qiskit_addon_cutting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,73 +9,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Circuit Cutting (:mod:`qiskit_addon_cutting`).
.. currentmodule:: qiskit_addon_cutting
Circuit Cutting
===============
.. autosummary::
:toctree: ../stubs/
:nosignatures:
cut_wires
expand_observables
partition_circuit_qubits
partition_problem
cut_gates
generate_cutting_experiments
reconstruct_expectation_values
.. autosummary::
:toctree: ../stubs/
:nosignatures:
:template: autosummary/class_no_inherited_members.rst
PartitionedCuttingProblem
instructions.CutWire
instructions.Move
Automatic Cut Finding
~~~~~~~~~~~~~~~~~~~~~
.. autosummary::
:toctree: ../stubs/
:nosignatures:
find_cuts
.. autosummary::
:toctree: ../stubs/
:nosignatures:
:template: autosummary/class_no_inherited_members.rst
OptimizationParameters
DeviceConstraints
Quasi-Probability Decomposition (QPD)
=====================================
.. autosummary::
:toctree: ../stubs/
:nosignatures:
:template: autosummary/class_no_inherited_members.rst
qpd.QPDBasis
qpd.BaseQPDGate
qpd.SingleQubitQPDGate
qpd.TwoQubitQPDGate
qpd.WeightType
.. autosummary::
:toctree: ../stubs/
:nosignatures:
qpd.generate_qpd_weights
qpd.decompose_qpd_instructions
qpd.qpdbasis_from_instruction
"""
"""Circuit cutting."""

from __future__ import annotations
from importlib.metadata import version, PackageNotFoundError
Expand Down
3 changes: 3 additions & 0 deletions qiskit_addon_cutting/cut_finding/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# Warning: this module is not documented and it does not have an RST file.
# If we ever publicly expose interfaces users can import from this module,
# we should set up its RST file.
"""Main automated cut finding functionality."""
1 change: 1 addition & 0 deletions qiskit_addon_cutting/instructions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# Reminder: update the RST file in docs/apidocs when adding new interfaces.
r"""Quantum circuit :class:`~qiskit.Instruction`\ s useful for circuit cutting."""

from .cut_wire import CutWire
Expand Down
1 change: 1 addition & 0 deletions qiskit_addon_cutting/qpd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# Reminder: update the RST file in docs/apidocs when adding new interfaces.
"""Main quasiprobability decomposition functionality."""

from .qpd_basis import QPDBasis
Expand Down
2 changes: 2 additions & 0 deletions qiskit_addon_cutting/qpd/instructions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

# Warning: this module is not documented and it does not have an RST file
# because its members are already documented in the parent module.
r"""Quantum circuit :class:`~qiskit.Instruction`\ s for representing quasiprobability decompositions."""

from .qpd_gate import BaseQPDGate, SingleQubitQPDGate, TwoQubitQPDGate
Expand Down
Loading

0 comments on commit 957bbf8

Please sign in to comment.