diff --git a/qiskit/circuit/library/__init__.py b/qiskit/circuit/library/__init__.py index 4125c76b1e65..8ca693d15d3f 100644 --- a/qiskit/circuit/library/__init__.py +++ b/qiskit/circuit/library/__init__.py @@ -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 ============== @@ -126,6 +130,7 @@ ZGate GlobalPhaseGate + Standard Directives =================== @@ -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 diff --git a/qiskit/circuit/library/standard_gates/__init__.py b/qiskit/circuit/library/standard_gates/__init__.py index 19a2bf770da2..be0e9dd04449 100644 --- a/qiskit/circuit/library/standard_gates/__init__.py +++ b/qiskit/circuit/library/standard_gates/__init__.py @@ -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