
    z	i                     t    S r SSKrSSKJr   " S S\5      r " S S\5      r " S S	\5      r " S
 S\5      rg)zGlobal R gates.    N)QuantumCircuitc                   @   ^  \ rS rSrSrS\S\S\SS4U 4S jjrS	rU =r	$ )
GR   u  Global R gate.

Circuit symbol:

.. code-block:: text

         ┌──────────┐
    q_0: ┤0         ├
         │          │
    q_1: ┤1 GR(ϴ,φ) ├
         │          │
    q_2: ┤2         ├
         └──────────┘

The global R gate is native to atomic systems (ion traps, cold neutrals). The global R
can be applied to multiple qubits simultaneously.

In the one-qubit case, this is equivalent to an R(theta, phi) operation,
and is thus reduced to the RGate. The global R gate is a direct sum of R
operations on all individual qubits.

.. math::

    GR(\theta, \phi) = \exp(-i \sum_{i=1}^{n} (\cos(\phi)X_i + \sin(\phi)Y_i) \theta/2)

Expanded Circuit:

.. plot::
   :alt: Diagram illustrating the previously described circuit.

   from qiskit.circuit.library import GR
   from qiskit.visualization.library import _generate_circuit_library_visualization
   import numpy as np
   circuit = GR(num_qubits=3, theta=np.pi/4, phi=np.pi/2)
   _generate_circuit_library_visualization(circuit)


num_qubitsthetaphireturnNc                    > SUS SUS S3n[        XS9nUR                  X#UR                  5        [        TU ]  XS9  U R                  UR                  5       U R                  5        g)z
Args:
    num_qubits: number of qubits.
    theta: rotation angle about axis determined by phi
    phi: angle of rotation axis in xy-plane
zGR(z.2fz, )nameN)r   rqubitssuper__init__appendto_gate)selfr   r   r	   r   circuit	__class__s         e/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/circuit/library/generalized_gates/gr.pyr   GR.__init__:   sb     U3Kr#c!, 7		%gnn-/GOO%t{{3     
__name__
__module____qualname____firstlineno____doc__intfloatr   __static_attributes____classcell__r   s   @r   r   r      s/    $L43 4u 45 4T 4 4r   r   c                   <   ^  \ rS rSrSrS\S\SS4U 4S jjrSrU =r	$ )	GRXI   u  Global RX gate.

**Circuit symbol:**

.. code-block:: text

         ┌──────────┐
    q_0: ┤0         ├
         │          │
    q_1: ┤1  GRX(ϴ) ├
         │          │
    q_2: ┤2         ├
         └──────────┘

The global RX gate is native to atomic systems (ion traps, cold neutrals). The global RX
can be applied to multiple qubits simultaneously.

In the one-qubit case, this is equivalent to an RX(theta) operations,
and is thus reduced to the RXGate. The global RX gate is a direct sum of RX
operations on all individual qubits.

.. math::

    GRX(\theta) = \exp(-i \sum_{i=1}^{n} X_i \theta/2)

**Expanded Circuit:**

.. plot::
   :alt: Diagram illustrating the previously described circuit.

    from qiskit.circuit.library import GRX
    from qiskit.visualization.library import _generate_circuit_library_visualization
    import numpy as np
    circuit = GRX(num_qubits=3, theta=np.pi/4)
    _generate_circuit_library_visualization(circuit)

r   r   r
   Nc                 "   > [         TU ]  XSS9  g)zsCreate a new Global RX (GRX) gate.

Args:
    num_qubits: number of qubits.
    theta: rotation angle about x-axis
r   r	   N)r   r   r   r   r   r   s      r   r   GRX.__init__p   s     	2r   r   r   r&   s   @r   r(   r(   I   s(    $L33 3u 3 3 3r   r(   c                   <   ^  \ rS rSrSrS\S\SS4U 4S jjrSrU =r	$ )	GRYz   u  Global RY gate.

**Circuit symbol:**

.. code-block:: text

         ┌──────────┐
    q_0: ┤0         ├
         │          │
    q_1: ┤1  GRY(ϴ) ├
         │          │
    q_2: ┤2         ├
         └──────────┘

The global RY gate is native to atomic systems (ion traps, cold neutrals). The global RY
can be applied to multiple qubits simultaneously.

In the one-qubit case, this is equivalent to an RY(theta) operation,
and is thus reduced to the RYGate. The global RY gate is a direct sum of RY
operations on all individual qubits.

.. math::

    GRY(\theta) = \exp(-i \sum_{i=1}^{n} Y_i \theta/2)

**Expanded Circuit:**

.. plot::
   :alt: Diagram illustrating the previously described circuit.

   from qiskit.circuit.library import GRY
   from qiskit.visualization.library import _generate_circuit_library_visualization
   import numpy as np
   circuit = GRY(num_qubits=3, theta=np.pi/4)
   _generate_circuit_library_visualization(circuit)

r   r   r
   Nc                 D   > [         TU ]  X[        R                  S-  S9  g)zsCreate a new Global RY (GRY) gate.

Args:
    num_qubits: number of qubits.
    theta: rotation angle about y-axis
   r+   N)r   r   nppir,   s      r   r   GRY.__init__   s     		:r   r   r   r&   s   @r   r/   r/   z   s(    $L;3 ;u ; ; ;r   r/   c                   <   ^  \ rS rSrSrS\S\SS4U 4S jjrSrU =r	$ )	GRZ   u  Global RZ gate.

**Circuit symbol:**

.. code-block:: text

         ┌──────────┐
    q_0: ┤0         ├
         │          │
    q_1: ┤1  GRZ(φ) ├
         │          │
    q_2: ┤2         ├
         └──────────┘

The global RZ gate is native to atomic systems (ion traps, cold neutrals). The global RZ
can be applied to multiple qubits simultaneously.

In the one-qubit case, this is equivalent to an RZ(phi) operation,
and is thus reduced to the RZGate. The global RZ gate is a direct sum of RZ
operations on all individual qubits.

.. math::

    GRZ(\phi) = \exp(-i \sum_{i=1}^{n} Z_i \phi)

**Expanded Circuit:**

.. plot::
   :alt: Diagram illustrating the previously described circuit.

   from qiskit.circuit.library import GRZ
   from qiskit.visualization.library import _generate_circuit_library_visualization
   import numpy as np
   circuit = GRZ(num_qubits=3, phi=np.pi/2)
   _generate_circuit_library_visualization(circuit)

r   r	   r
   Nc                 X   > [         TU ]  USS9  U R                  X R                  5        g)zqCreate a new Global RZ (GRZ) gate.

Args:
    num_qubits: number of qubits.
    phi: rotation angle about z-axis
grzr   N)r   r   rzr   )r   r   r	   r   s      r   r   GRZ.__init__   s'     	%0[[!r   r   r   r&   s   @r   r7   r7      s(    $L"3 "U "t " "r   r7   )	r!   numpyr3   qiskit.circuit.quantumcircuitr   r   r(   r/   r7   r   r   r   <module>r?      sC      834 34l.3" .3b.;" .;b/". /"r   