Skip to content

Commit

Permalink
added documentation for get_standard_gate_name_mapping (#13230)
Browse files Browse the repository at this point in the history
* added documentation for get_standard_gate_name_mapping

* doc fix at line 145

* Update qiskit/circuit/library/__init__.py

Co-authored-by: Luciano Bello <[email protected]>

* added docs get_standard_gate_name_mapping

* reformatting at line 65-66

* update fix formatting

* Update qiskit/circuit/library/standard_gates/__init__.py

Co-authored-by: Eric Arellano <[email protected]>

* docfix using autofunction

* content updated get_standard_gate_name_mapping

* Update qiskit/circuit/library/standard_gates/__init__.py

Co-authored-by: Eric Arellano <[email protected]>

* Update qiskit/circuit/library/__init__.py

Co-authored-by: Eric Arellano <[email protected]>

---------

Co-authored-by: Luciano Bello <[email protected]>
Co-authored-by: Eric Arellano <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2024
1 parent 3e136d7 commit 3889fe0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
8 changes: 7 additions & 1 deletion qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
circuit.append(gate, [0, 1, 4, 2, 3])
circuit.draw('mpl')
The library is organized in several sections.
The library is organized in several sections. The function
:func:`.get_standard_gate_name_mapping` allows you to see the available standard gates and operations.
.. autofunction:: get_standard_gate_name_mapping
Standard gates
==============
Expand Down Expand Up @@ -126,6 +130,7 @@
ZGate
GlobalPhaseGate
Standard Directives
===================
Expand Down Expand Up @@ -605,3 +610,4 @@
from .grover_operator import GroverOperator, grover_operator
from .phase_oracle import PhaseOracle
from .overlap import UnitaryOverlap, unitary_overlap
from .standard_gates import get_standard_gate_name_mapping
21 changes: 20 additions & 1 deletion qiskit/circuit/library/standard_gates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,26 @@

def get_standard_gate_name_mapping():
"""Return a dictionary mapping the name of standard gates and instructions to an object for
that name."""
that name.
Examples:
.. code-block:: python
from qiskit.circuit.library import get_standard_gate_name_mapping
gate_name_map = get_standard_gate_name_mapping()
cx_object = gate_name_map["cx"]
print(cx_object)
print(type(cx_object))
.. code-block:: text
Instruction(name='cx', num_qubits=2, num_clbits=0, params=[])
_SingletonCXGate
"""

from qiskit.circuit.parameter import Parameter
from qiskit.circuit.measure import Measure
from qiskit.circuit.delay import Delay
Expand Down

0 comments on commit 3889fe0

Please sign in to comment.