Skip to content

Commit

Permalink
Small doc formatting issues (Qiskit#10574)
Browse files Browse the repository at this point in the history
* small doc fixes

* more small changes

* Update qiskit/extensions/quantum_initializer/squ.py

Co-authored-by: Julien Gacon <[email protected]>

* improve gate docs

* Apply suggestions from code review

Co-authored-by: Julien Gacon <[email protected]>

* Update qiskit/converters/circuit_to_dag.py

* Update qiskit/execute_function.py

* Circuits as Directed Acyclic Graphs

* a quantum circuit as a Directed Acyclic Graphs (DAG

* __

* Fix errant plural

---------

Co-authored-by: Julien Gacon <[email protected]>
Co-authored-by: Jake Lishman <[email protected]>
  • Loading branch information
3 people authored Sep 22, 2023
1 parent d1d86a9 commit d3a6172
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 27 deletions.
8 changes: 4 additions & 4 deletions qiskit/circuit/gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,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 @@ -487,7 +487,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`.
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
============
Circuits as Directed Acyclic Graphs
===================================
.. 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 Directed Acyclic Graph (DAG)
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
#. ``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
2 changes: 1 addition & 1 deletion qiskit/visualization/pass_manager_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ 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
This function needs `pydot <https://github.com/pydot/pydot>`__, which in turn needs
`Graphviz <https://www.graphviz.org/>`__ to be installed.
Args:
Expand Down

0 comments on commit d3a6172

Please sign in to comment.