
    z	iF                        S r SSKrSSKJr  SSKrSSKJrJr  SSKJ	r	  SSK
Jr  SSKJr  \" SS/SS	\R                  " S
5      -  //5       " S S\5      5       r\" SS/SS\R                  " S
5      -  //5       " S S\5      5       rg)zT and Tdg gate.    N)Optional)SingletonGatestdlib_singleton_key)	PhaseGate)with_gate_array)StandardGate   y      ?      ?   c                      ^  \ rS rSrSr\R                  rSS\\	   4U 4S jjjr
\" 5       rS rSS\4S jjrSS\S\4S	 jjrS
 rSrU =r$ )TGate   u|  Single qubit T gate (Z**0.25).

It induces a :math:`\pi/4` phase, and is sometimes called the pi/8 gate
(because of how the RZ(\pi/4) matrix looks like).

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::

    T = \begin{pmatrix}
            1 & 0 \\
            0 & e^{i\pi/4}
        \end{pmatrix}

Circuit symbol:

.. code-block:: text

         ┌───┐
    q_0: ┤ T ├
         └───┘

Equivalent to a :math:`\pi/4` radian rotation about the Z axis.
labelc                 &   > [         TU ]  SS/ US9  g)z2
Args:
    label: An optional label for the gate.
tr	   r   Nsuper__init__selfr   	__class__s     a/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/circuit/library/standard_gates/t.pyr   TGate.__init__;   s    
 	a51    c                     SSK Jn  UR                  [        R                  R                  U R                  5      SU R                  S9U l        gzDefault definitionr   )QuantumCircuitT)legacy_qubitsnameN)	qiskit.circuitr   _from_circuit_datar   T_get_definitionparamsr   
definitionr   r   s     r   _defineTGate._defineD   sA     	2 );;NN**4;;7tRVR[R[ < 
r   	annotatedc                     [        5       $ )a  Return inverse T gate (i.e. Tdg).

Args:
    annotated: when set to ``True``, this is typically used to return an
        :class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
        :class:`.Gate`. However, for this class this argument is ignored as the inverse
        of this gate is always a :class:`.TdgGate`.

Returns:
    TdgGate: inverse of :class:`.TGate`
)TdgGater   r)   s     r   inverseTGate.inverseQ   s     yr   exponentc                 @    [        S[        R                  -  U-  5      $ )Ng      ?r   numpypir   r/   r)   s      r   powerTGate.power_   s    8344r   c                 "    [        U[        5      $ N)
isinstancer   r   others     r   __eq__TGate.__eq__b   s    %''r   r%   r8   F)__name__
__module____qualname____firstlineno____doc__r   r"   _standard_gater   strr   r   _singleton_lookup_keyr'   boolr-   floatr5   r<   __static_attributes____classcell__r   s   @r   r   r      sa    < "^^N2hsm 2 2 12
 5e 5 5( (r   r   y      ?      c                      ^  \ rS rSrSr\R                  rSS\\	   4U 4S jjjr
\" 5       rS rSS\4S jjrSS\S\4S	 jjrS
 rSrU =r$ )r+   f   uB  Single qubit T-adjoint gate (~Z**0.25).

It induces a :math:`-\pi/4` phase.

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::

    Tdg = \begin{pmatrix}
            1 & 0 \\
            0 & e^{-i\pi/4}
        \end{pmatrix}

Circuit symbol:

.. code-block:: text

         ┌─────┐
    q_0: ┤ Tdg ├
         └─────┘

Equivalent to a :math:`-\pi/4` radian rotation about the Z axis.
r   c                 &   > [         TU ]  SS/ US9  g)zCreate new Tdg gate.tdgr	   r   Nr   r   s     r   r   TdgGate.__init__   s    2U3r   c                     SSK Jn  UR                  [        R                  R                  U R                  5      SU R                  S9U l        gr   )	r    r   r!   r   Tdgr#   r$   r   r%   r&   s     r   r'   TdgGate._define   sC     	2 );;,,T[[9TXT]T] < 
r   r)   c                     [        5       $ )a  Return inverse Tdg gate (i.e. T).

Args:
    annotated: when set to ``True``, this is typically used to return an
        :class:`.AnnotatedOperation` with an inverse modifier set instead of a concrete
        :class:`.Gate`. However, for this class this argument is ignored as the inverse
        of this gate is always a :class:`.TGate`.

Returns:
    TGate: inverse of :class:`.TdgGate`
)r   r,   s     r   r-   TdgGate.inverse   s     wr   r/   c                 @    [        S[        R                  -  U-  5      $ )Ng      пr1   r4   s      r   r5   TdgGate.power   s    )H455r   c                 "    [        U[        5      $ r8   )r9   r+   r:   s     r   r<   TdgGate.__eq__   s    %))r   r>   r8   r?   )r@   rA   rB   rC   rD   r   rS   rE   r   rF   r   r   rG   r'   rH   r-   rI   r5   r<   rJ   rK   rL   s   @r   r+   r+   f   sc    : "%%N4hsm 4 4 12
 6e 6 6* *r   r+   )rD   mathtypingr   r2   qiskit.circuit.singletonr   r   'qiskit.circuit.library.standard_gates.pr   qiskit.circuit._utilsr   qiskit._accelerate.circuitr   sqrtr   r+    r   r   <module>rc      s        H = 1 3 1a&1v15678I(M I( 9I(X 1a&1v15678E*m E* 9E*r   