Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small doc formatting issues #10574

Merged
merged 18 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions qiskit/circuit/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,15 @@ def control(
"""Return controlled version of gate. See :class:`.ControlledGate` for usage.

Args:
num_ctrl_qubits: number of controls to add to gate (default=1)
num_ctrl_qubits: number of controls to add to gate (default: ``1``)
label: optional gate label
ctrl_state: The control state in decimal or as a bitstring
(e.g. '111'). If None, use 2**num_ctrl_qubits-1.
(e.g. ``'111'``). If ``None``, use ``2**num_ctrl_qubits-1``.

Returns:
qiskit.circuit.ControlledGate: Controlled version of gate. This default algorithm
uses num_ctrl_qubits-1 ancillae qubits so returns a gate of size
num_qubits + 2*num_ctrl_qubits - 1.
uses ``num_ctrl_qubits-1`` ancilla qubits so returns a gate of size
``num_qubits + 2*num_ctrl_qubits - 1``.

Raises:
QiskitError: unrecognized mode or invalid ctrl_state
Expand Down
2 changes: 1 addition & 1 deletion qiskit/circuit/instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ def qasm(self):
"""Return a default OpenQASM string for the instruction.

Derived instructions may override this to print in a
different format (e.g. measure q[0] -> c[0];).
different format (e.g. ``measure q[0] -> c[0];``).
"""
name_param = self.name
if self.params:
Expand Down
2 changes: 1 addition & 1 deletion qiskit/converters/circuit_to_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


def circuit_to_dag(circuit, copy_operations=True, *, qubit_order=None, clbit_order=None):
"""Build a ``DAGCircuit`` object from a ``QuantumCircuit``.
"""Build a :class:`~.DAGCircuit` object from a :class:`~.QuantumCircuit`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, the leading ~ is not needed here as this simply truncates the path of the object. Since here there's no path, as you just used .<Object>, there's nothing to truncate (but it's not harmful afaik so no need to change) 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

1ucian0 marked this conversation as resolved.
Show resolved Hide resolved

Args:
circuit (QuantumCircuit): the input circuit.
Expand Down
2 changes: 1 addition & 1 deletion qiskit/converters/circuit_to_dagdependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def circuit_to_dagdependency(circuit, create_preds_and_succs=True):
"""Build a ``DAGDependency`` object from a ``QuantumCircuit``.
"""Build a ``DAGDependency`` object from a :class:`~.QuantumCircuit`.

Args:
circuit (QuantumCircuit): the input circuit.
Expand Down
4 changes: 2 additions & 2 deletions qiskit/dagcircuit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

.. currentmodule:: qiskit.dagcircuit

DAG Circuits
============
DAG (directed acyclic graph) Circuits
=====================================
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unusual to put the definition of an acronym in a title. Probably a bit better to say it as:

DAG Circuits

Quantum operations in the absence of control-flow operations can be represented by a directed acyclic graph (DAG).
...

or have the title as "Circuits as Directed Acyclic Graphs" and define the "DAG" acronym in the prose.

Copy link
Member Author

@1ucian0 1ucian0 Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 430d0b3


.. autosummary::
:toctree: ../stubs/
Expand Down
7 changes: 3 additions & 4 deletions qiskit/dagcircuit/dagdependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@


class DAGDependency:
"""Object to represent a quantum circuit as a directed acyclic graph
"""Object to represent a quantum circuit as a DAG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think using the full text here was clearer, but I don't feel strongly.

Copy link
Member Author

@1ucian0 1ucian0 Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 16b75c7

via operation dependencies (i.e. lack of commutation).

The nodes in the graph are operations represented by quantum gates.
Expand Down Expand Up @@ -143,7 +143,7 @@ def calibrations(self):
"""Return calibration dictionary.

The custom pulse definition of a given gate is of the form
{'gate_name': {(qubits, params): schedule}}
``{'gate_name': {(qubits, params): schedule}}``.
"""
return dict(self._calibrations)

Expand Down Expand Up @@ -530,8 +530,7 @@ def draw(self, scale=0.7, filename=None, style="color"):
'color' (default): color input/output/op nodes

Returns:
Ipython.display.Image: if in Jupyter notebook and not saving to file,
otherwise None.
Ipython.display.Image: if in Jupyter notebook and not saving to file, otherwise None.
"""
from qiskit.visualization.dag_visualization import dag_drawer

Expand Down
11 changes: 5 additions & 6 deletions qiskit/execute_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,17 @@ def execute(

basis_gates (list[str]):
List of basis gate names to unroll to.
e.g: ``['u1', 'u2', 'u3', 'cx']``
e.g: ``['u1', 'u2', 'u3', 'cx']``.
If ``None``, do not unroll.

coupling_map (CouplingMap or list): Coupling map (perhaps custom) to
target in mapping. Multiple formats are supported:

#. CouplingMap instance
#. list
Must be given as an adjacency matrix, where each entry
#. :class:`~.CouplingMap` instance
1ucian0 marked this conversation as resolved.
Show resolved Hide resolved
#. ``list``:
must be given as an adjacency matrix, where each entry
specifies all two-qubit interactions supported by backend
e.g:
``[[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]``
e.g: ``[[0, 1], [0, 3], [1, 2], [1, 5], [2, 5], [4, 1], [5, 3]]``

backend_properties (BackendProperties):
Properties returned by a backend, including information on gate
Expand Down
14 changes: 7 additions & 7 deletions qiskit/extensions/quantum_initializer/squ.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@


class SingleQubitUnitary(Gate):
"""
u = 2*2 unitary (given as a (complex) numpy.ndarray)

mode - determines the used decomposition by providing the rotation axes
"""Single-qubit unitary.

up_to_diagonal - the single-qubit unitary is decomposed up to a diagonal matrix,
i.e. a unitary u' is implemented such that there exists a 2*2 diagonal
gate d with u = d.dot(u').
Args:
unitary_matrix: :math:`2 \times 2` unitary (given as a (complex) ``numpy.ndarray``).
mode: determines the used decomposition by providing the rotation axes.
up_to_diagonal: the single-qubit unitary is decomposed up to a diagonal matrix,
i.e. a unitary :math:`U'` is implemented such that there exists a diagonal
matrix :math:`D` with :math:`U = D U'`.
"""

def __init__(self, unitary_matrix, mode="ZYZ", up_to_diagonal=False):
Expand Down
4 changes: 2 additions & 2 deletions qiskit/visualization/pass_manager_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def pass_manager_drawer(pass_manager, filename=None, style=None, raw=False):
"""
Draws the pass manager.

This function needs `pydot <https://github.com/erocarrera/pydot>`__, which in turn needs
`Graphviz <https://www.graphviz.org/>`__ to be installed.
This function needs `pydot <https://github.com/pydot/pydot>`_, which in turn needs
`Graphviz <https://www.graphviz.org/>`_ to be installed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double underscore is also fine here - the single creates a named hyperlink (so you could later use <Graphviz_> as if it was the URL and it'd alias the first one), while the double doesn't allow the re-use. The docs are here: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#embedded-uris-and-aliases.

No need to change anything here - both are fine - just pointing out that you don't need to worry about this in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

always learning new things. reverting in c6af56c so the diff is cleaner.


Args:
pass_manager (PassManager): the pass manager to be drawn
Expand Down