
    z	i                        S r SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr   S     SS
 jjr   S       SS jjrSSS jjrg)z&
Random symplectic operator functions
    )annotationsN)default_rng)random_clifford_tableau   )Clifford)Pauli)	PauliListc                Z   Uc  [         R                  R                  5       nO7[        U[         R                  R                  5      (       a  UnO[        U5      nUR                  SU [        S9nUR                  SU [        S9nU(       a  UR                  S5      OSn[        XEU45      nU$ )a  Return a random Pauli.

Args:
    num_qubits (int): the number of qubits.
    group_phase (bool): Optional. If True generate random phase.
                        Otherwise the phase will be set so that the
                        Pauli coefficient is +1 (default: False).
    seed (int or np.random.Generator): Optional. Set a fixed seed or
                                       generator for RNG.

Returns:
    Pauli: a random Pauli
   sizedtype   r   )nprandomr   
isinstance	Generatorintegersboolr   )
num_qubitsgroup_phaseseedrngzxphasepaulis           i/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/quantum_info/operators/symplectic/random.pyrandom_paulir      s      |ii##%	D"))--	.	.$QZt4AQZt4A*CLLOE1- EL    c                   Uc  [         R                  R                  5       nO7[        U[         R                  R                  5      (       a  UnO[        U5      nUR                  SX4S9R                  [        5      nUR                  SX4S9R                  [        5      nU(       a'  UR                  SUS9n[        R                  " XVU5      $ [        R                  " XV5      $ )a  Return a random PauliList.

Args:
    num_qubits (int): the number of qubits.
    size (int): Optional. The length of the Pauli list (Default: 1).
    seed (int or np.random.Generator): Optional. Set a fixed seed or generator for RNG.
    phase (bool): If True the Pauli phases are randomized, otherwise the phases are fixed to 0.
                 [Default: True]

Returns:
    PauliList: a random PauliList.
r   )r   r   )
r   r   r   r   r   r   astyper   r	   from_symplectic)r   r   r   r   r   r   r   _phases           r   random_pauli_listr%   9   s    $ |ii##%	D"))--	.	.$Qd/077=AQd/077=Aad+((v66$$Q**r    c                   Uc  [         R                  R                  5       nO7[        U[         R                  R                  5      (       a  UnO[        U5      nUR                  SS[         R                  S9S   n[        XS9n[        USS9$ )a  Return a random Clifford operator.

The Clifford is sampled using the method of Reference [1].

Args:
    num_qubits (int): the number of qubits for the Clifford
    seed (int or np.random.Generator): Optional. Set a fixed seed or
                                       generator for RNG.

Returns:
    Clifford: a random Clifford operator.

Reference:
    1. S. Bravyi and D. Maslov, *Hadamard-free circuits expose the
       structure of the Clifford group*.
       `arXiv:2003.09412 [quant-ph] <https://arxiv.org/abs/2003.09412>`_
i r   r   r   )r   F)validate)	r   r   r   r   r   r   uint64r   r   )r   r   r   tableaus       r   random_cliffordr*   Z   su    $ |ii##%	D"))--	.	.$<<Qbii<8;D%j<GGe,,r    )FN)r   intr   r   r    int | np.random.Generator | None)r   NT)r   r+   r   r+   r   r,   r   r   )N)r   r+   r   r,   )__doc__
__future__r   numpyr   numpy.randomr   %qiskit._accelerate.synthesis.cliffordr   cliffordr   r   r   
pauli_listr	   r   r%   r*    r    r   <module>r5      s    #  $ I   ! Z^"&6V> -1	++
+ ++ 	+B-r    