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

added documentation for get_standard_gate_name_mapping #13230

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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: 8 additions & 0 deletions qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@
ZGate
GlobalPhaseGate


Utility functions (section TBD)
================================

.. autofunction:: get_standard_gate_name_mapping
Copy link
Collaborator

Choose a reason for hiding this comment

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

Qiskit devs: do you have any suggestions on what to name the section and where it makes sense to live in this module page? I don't use the circuit library enough to have an opinion.

Copy link
Member

Choose a reason for hiding this comment

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

I put it in the prelude (without a section) as it is the only one (see 18693b7). If, in the future, we get more, we can create a tooling section. what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this:
get_standard_gate_name_mapping

If a native speaker can check the English, we are good to merge this one.

Copy link
Member

Choose a reason for hiding this comment

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

If a native speaker can check the English, we are good to merge this one.

@Eric-Arellano ?



Standard Directives
===================

Expand Down Expand Up @@ -573,3 +580,4 @@
from .grover_operator import GroverOperator
from .phase_oracle import PhaseOracle
from .overlap import UnitaryOverlap
from .standard_gates import get_standard_gate_name_mapping
20 changes: 19 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,25 @@

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.

For Example:

.. code-block::

from qiskit.circuit.library.standard_gates 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))

.. parsed-literal::

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
Loading