Skip to content

Commit

Permalink
Added links from gate classes' circuit library pages to their corresp…
Browse files Browse the repository at this point in the history
…onding QuantumCircuit methods (#8370)

* Added link from IGate to QuantumCircuit.id method in Circuit Library

* Added link from UGate to QuantumCircuit.u method in Circuit Library

* Added link from PhaseGate to QuantumCircuit.p  method in API reference

* Added link from XGate to QuantumCircuit.x method in Circuit Library

* Added link from YGate to QuantumCircuit.y method in Circuit Library

* Added link from ZGate to QuantumCircuit.z in Circuit Library

* Added link from HGate to QuantumCircuit.h method in Circuit Library

* Added link from SGate to QuantumCircuit.s and from SdgGate to QuantumCircuit.sdg in Circuit Library

* Added link from TGate to QuantumCircuit.t and from TdgGate to QuantumCircuit.tdg in Circuit Library

* Added link from RXGate to QuantumCircuit.rx in Circuit Library

* Added link from RYGate to QuantumCircuit.ry in Circuit Library

* Added link from RZGate to QuantumCircuit.rz in Circuit Library

* Added link from CUGate to QuantumCircuit.cu method in Circuit Library

* Added link from CPhaseGate to QuantumCircuit.cp method in Circuit Library

* Added link from CXGate to QuantumCircuit.cx method in Circuit Library

* Added link from CCXGate to QuantumCircuit.ccx method in Circuit Library

* Added link from CYGate to QuantumCircuit.cy method in Circuit Library

* Added link from CZGate to QuantumCircuit.cz method in Circuit Library

* Added link from CHGate to QuantumCircuit.ch method in Circuit Library

* Added link from CRXGate to QuantumCircuit.crx method in Circuit Library

* Added link from CRYGate to QuantumCircuit.cry method in Circuit Library

* Added link from CRZGate to QuantumCircuit.crz method in Circuit Library

* Added link from SwapGate to QuantumCircuit.swap method in Circuit Library

* Added link from CSwapGate to QuantumCircuit.cswap method in Circuit Library

* corrected wrong phases in Sdg and Tdg gates

* Added links corresponding to RCCX, RC3X and MCX gates

* Added MCPhaseGate link to mcp method

* Added links corresponding to RXX, RYY, RZZ and RZX gates

* Added DCXGate link

* Added ECRGate link

* Added iSWAPGate link

* Added SX, SXdg and CSX links

* Added RGate link

* Added mention to i and cnot methods

* Added RVGate, Barrier and PauliGate links

* Added mention to toffoli and fredkin methods
  • Loading branch information
Guillermo-Mijares-Vilarino committed Jul 22, 2022
1 parent 1312624 commit 5b166c0
Show file tree
Hide file tree
Showing 25 changed files with 143 additions and 5 deletions.
6 changes: 5 additions & 1 deletion qiskit/circuit/barrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Barrier instruction."""
"""Barrier instruction.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.barrier` method.
"""

from qiskit.exceptions import QiskitError
from .instruction import Instruction
Expand Down
5 changes: 4 additions & 1 deletion qiskit/circuit/library/generalized_gates/pauli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class PauliGate(Gate):
a single pass on the statevector.
The functionality is equivalent to applying
the pauli gates sequentially using standard Qiskit gates
the pauli gates sequentially using standard Qiskit gates.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.pauli` method.
"""

def __init__(self, label):
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/generalized_gates/rv.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ class RVGate(Gate):
r"""Rotation around arbitrary rotation axis :math:`v` where :math:`|v|` is
angle of rotation in radians.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rv` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/dcx.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class DCXGate(Gate):
A 2-qubit Clifford gate consisting of two back-to-back
CNOTs with alternate controls.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.dcx` method.
.. parsed-literal::
┌───┐
q_0: ──■──┤ X ├
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/ecr.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class ECRGate(Gate):
single-qubit pre-rotations. The echoing procedure mitigates some
unwanted terms (terms other than ZX) to cancel in an experiment.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ecr` method.
**Circuit Symbol:**
.. parsed-literal::
Expand Down
6 changes: 6 additions & 0 deletions qiskit/circuit/library/standard_gates/h.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ class HGate(Gate):
changing computation basis from :math:`|0\rangle,|1\rangle` to
:math:`|+\rangle,|-\rangle` and vice-versa.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.h` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -108,6 +111,9 @@ class CHGate(ControlledGate):
Applies a Hadamard on the target qubit if the control is
in the :math:`|1\rangle` state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ch` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
4 changes: 4 additions & 0 deletions qiskit/circuit/library/standard_gates/i.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class IGate(Gate):
Identity gate corresponds to a single-qubit gate wait cycle,
and should not be optimized or unrolled (it is an opaque gate).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.i` and
:meth:`~qiskit.circuit.QuantumCircuit.id` methods.
**Matrix Representation:**
.. math::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/iswap.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class iSwapGate(Gate):
states and phase the :math:`|01\rangle` and :math:`|10\rangle`
amplitudes by i.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.iswap` method.
**Circuit Symbol:**
.. parsed-literal::
Expand Down
9 changes: 9 additions & 0 deletions qiskit/circuit/library/standard_gates/p.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class PhaseGate(Gate):
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.p` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -129,6 +132,9 @@ class CPhaseGate(ControlledGate):
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cp` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -245,6 +251,9 @@ class MCPhaseGate(ControlledGate):
This is a diagonal and symmetric gate that induces a
phase on the state of the target qubit, depending on the state of the control qubits.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.mcp` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/r.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
class RGate(Gate):
r"""Rotation θ around the cos(φ)x + sin(φ)y axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.r` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
6 changes: 6 additions & 0 deletions qiskit/circuit/library/standard_gates/rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
class RXGate(Gate):
r"""Single-qubit rotation about the X axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rx` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -107,6 +110,9 @@ def __array__(self, dtype=None):
class CRXGate(ControlledGate):
r"""Controlled-RX gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.crx` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/rxx.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class RXXGate(Gate):
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rxx` method.
**Circuit Symbol:**
.. parsed-literal::
Expand Down
6 changes: 6 additions & 0 deletions qiskit/circuit/library/standard_gates/ry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
class RYGate(Gate):
r"""Single-qubit rotation about the Y axis.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ry` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -106,6 +109,9 @@ def __array__(self, dtype=None):
class CRYGate(ControlledGate):
r"""Controlled-RY gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cry` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/ryy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class RYYGate(Gate):
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.ryy` method.
**Circuit Symbol:**
.. parsed-literal::
Expand Down
6 changes: 6 additions & 0 deletions qiskit/circuit/library/standard_gates/rz.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class RZGate(Gate):
This is a diagonal gate. It can be implemented virtually in hardware
via framechanges (i.e. at zero error and duration).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rz` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -121,6 +124,9 @@ class CRZGate(ControlledGate):
This is a diagonal but non-symmetric gate that induces a
phase on the state of the target qubit, depending on the control state.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.crz` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/rzx.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class RZXGate(Gate):
The cross-resonance gate (CR) for superconducting qubits implements
a ZX interaction (however other terms are also present in an experiment).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rzx` method.
**Circuit Symbol:**
.. parsed-literal::
Expand Down
3 changes: 3 additions & 0 deletions qiskit/circuit/library/standard_gates/rzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class RZZGate(Gate):
This gate is symmetric, and is maximally entangling at :math:`\theta = \pi/2`.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.rzz` method.
**Circuit Symbol:**
.. parsed-literal::
Expand Down
8 changes: 7 additions & 1 deletion qiskit/circuit/library/standard_gates/s.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class SGate(Gate):
This is a Clifford gate and a square-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.s` method.
**Matrix Representation:**
.. math::
Expand Down Expand Up @@ -82,6 +85,9 @@ class SdgGate(Gate):
This is a Clifford gate and a square-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sdg` method.
**Matrix Representation:**
.. math::
Expand All @@ -99,7 +105,7 @@ class SdgGate(Gate):
q_0: ┤ Sdg ├
└─────┘
Equivalent to a :math:`\pi/2` radian rotation about the Z axis.
Equivalent to a :math:`-\pi/2` radian rotation about the Z axis.
"""

def __init__(self, label: Optional[str] = None):
Expand Down
7 changes: 7 additions & 0 deletions qiskit/circuit/library/standard_gates/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class SwapGate(Gate):
This is a symmetric and Clifford gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.swap` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -112,6 +115,10 @@ def __array__(self, dtype=None):
class CSwapGate(ControlledGate):
r"""Controlled-SWAP gate, also known as the Fredkin gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cswap` and
:meth:`~qiskit.circuit.QuantumCircuit.fredkin` methods.
**Circuit symbol:**
.. parsed-literal::
Expand Down
9 changes: 9 additions & 0 deletions qiskit/circuit/library/standard_gates/sx.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
class SXGate(Gate):
r"""The single-qubit Sqrt(X) gate (:math:`\sqrt{X}`).
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sx` method.
**Matrix Representation:**
.. math::
Expand Down Expand Up @@ -112,6 +115,9 @@ def __array__(self, dtype=None):
class SXdgGate(Gate):
r"""The inverse single-qubit Sqrt(X) gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.sxdg` method.
.. math::
\sqrt{X}^{\dagger} = \frac{1}{2} \begin{pmatrix}
Expand Down Expand Up @@ -167,6 +173,9 @@ def __array__(self, dtype=None):
class CSXGate(ControlledGate):
r"""Controlled-√X gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.csx` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down
8 changes: 7 additions & 1 deletion qiskit/circuit/library/standard_gates/t.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class TGate(Gate):
This is a non-Clifford gate and a fourth-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.t` method.
**Matrix Representation:**
.. math::
Expand Down Expand Up @@ -83,6 +86,9 @@ class TdgGate(Gate):
This is a non-Clifford gate and a fourth-root of Pauli-Z.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.tdg` method.
**Matrix Representation:**
.. math::
Expand All @@ -100,7 +106,7 @@ class TdgGate(Gate):
q_0: ┤ Tdg ├
└─────┘
Equivalent to a :math:`\pi/2` radian rotation about the Z axis.
Equivalent to a :math:`-\pi/4` radian rotation about the Z axis.
"""

def __init__(self, label: Optional[str] = None):
Expand Down
6 changes: 6 additions & 0 deletions qiskit/circuit/library/standard_gates/u.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
class UGate(Gate):
r"""Generic single-qubit rotation gate with 3 Euler angles.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.u` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down Expand Up @@ -131,6 +134,9 @@ class CUGate(ControlledGate):
This is a controlled version of the U gate (generic single qubit rotation),
including a possible global phase :math:`e^{i\gamma}` of the U gate.
Can be applied to a :class:`~qiskit.circuit.QuantumCircuit`
with the :meth:`~qiskit.circuit.QuantumCircuit.cu` method.
**Circuit symbol:**
.. parsed-literal::
Expand Down

0 comments on commit 5b166c0

Please sign in to comment.