Ë
    èÿæiØ(  ã                   óä  — d dl Z d dlmZmZmZmZmZmZmZm	Z	m
Z
 d dlZ ej                  dej                  fdej                  fgd¬«      Z e	e«      Zej                   xZZej                    Z e
eee¬«      d„ «       Z e
eee¬«      d	„ «       Z e
eee¬«      d
„ «       Z e
eee¬«      d„ «       Z e
eee¬«      d„ «       Z e
eee¬«      d„ «       Z e
eee¬«      d„ «       Z e
eee¬«      d„ «       Z ej                  de j8                  z  «      Z ej
                  de j8                  z  «      Z e
eee¬«      d„ «       Z e
eee¬«      d„ «       Z  e
eee¬«      d„ «       Z!dd„Z"dd„Z#y)é    N)	ÚconfigÚcudaÚfloat32Úfloat64Úuint32Úint64Úuint64Ú
from_dtypeÚjitÚs0Ús1T)Úalign)ÚforceobjÚloopliftÚnopythonc                 ó  — t        |«      }t        |«      }|t        d«      z   }||t        d«      z	  z  t        d«      z  }||t        d«      z	  z  t        d«      z  }||t        d«      z	  z  }|| |   d<   || |   d<   y	)
aÁ  Use SplitMix64 to generate an xoroshiro128p state from 64-bit seed.

    This ensures that manually set small seeds don't result in a predictable
    initial sequence from the random number generator.

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: uint64
    :param index: offset in states to update
    :type seed: int64
    :param seed: seed value to use when initializing state
    l   |”~åf»q	 é   l   ¹eÉ9´Âz é   l   ëb&ì&‚&	 é   r   r   N)r   r	   r   )ÚstatesÚindexÚseedÚzs       úf/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/numba/cuda/random.pyÚinit_xoroshiro128p_stater   .   sŽ   € ô �%‹L€EÜ�$‹<€DàŒvÐ(Ó)Ñ)€AØ	
ˆa”6˜"“:‰oÑ	¤&Ð);Ó"<Ñ<€AØ	
ˆa”6˜"“:‰oÑ	¤&Ð);Ó"<Ñ<€AØ	ˆQ”&˜“*‰_Ñ€Aà€Fˆ5�M�$ÑØ€Fˆ5�M�$Òó    c                 ó\   — t        | «      } t        |«      }| |z  | t        d|z
  «      z	  z  S )zLeft rotate x by k bits.é@   )r	   r   )ÚxÚks     r   Úrotlr!   H   s2   € ô 	ˆq‹	€AÜˆq‹	€AØ�‰F�qœF 2¨¡6›NÑ*Ñ+Ð+r   c                 ó  — t        |«      }| |   d   }| |   d   }||z   }||z  }t        t        |t        d«      «      «      |z  |t        d«      z  z  | |   d<   t        t        |t        d«      «      «      | |   d<   |S )zýReturn the next random uint64 and advance the RNG in states[index].

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: int64
    :param index: offset in states to update
    :rtype: uint64
    r   r   é7   é   é$   )r   r	   r!   r   )r   r   r   r   Úresults        r   Úxoroshiro128p_nextr'   P   s�   € ô �%‹L€EØ	�‰�tÑ	€BØ	�‰�tÑ	€BØ�"‰W€Fàˆ"�H€BÜ ¤ b¬&°«*Ó!5Ó6¸Ñ;¸rÄVÈBÃZÑ?OÑP€Fˆ5�M�$ÑÜ ¤ b¬&°«*Ó!5Ó6€Fˆ5�M�$Ñà€Mr   c                 óP  — t        |«      }t        d«      t        d«      f}t        d«      }t        d«      }t        d«      D ]Q  }t        d«      D ]A  }||   t        d«      t        |«      z  z  r|| |   d   z  }|| |   d   z  }t	        | |«       ŒC ŒS || |   d<   || |   d<   y	)
zÛAdvance the RNG in ``states[index]`` by 2**64 steps.

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: int64
    :param index: offset in states to update
    l   ËzKWŸ`u l   "U.XC r   é   r   é   r   r   N)r   r	   Úranger   r'   )r   r   Újumpr   r   ÚiÚbs          r   Úxoroshiro128p_jumpr/   f   s¸   € ô �%‹L€EäÐ%Ó&¬Ð/AÓ(BÐC€Dä	�‹€BÜ	�‹€Bä�1ŽXˆÜ�r–ˆAØ�A‰wœ& ›)¤v¨a£yÑ0Ò1Ø�f˜U‘m DÑ)Ñ)�Ø�f˜U‘m DÑ)Ñ)�Ü˜v uÕ-ñ	 ð ð €Fˆ5�M�$ÑØ€Fˆ5�M�$Òr   c                 ó|   — t        | «      } | t        d«      z	  t        d«      t        d«      t        d«      z  z  z  S )z7Convert uint64 to float64 value in the range [0.0, 1.0)é   r*   é5   )r	   r   r   ©r   s    r   Úuint64_to_unit_float64r4   �   s6   € ô 	ˆq‹	€AØ”˜“‰O¤¨£
¬f°Q«i¼6À"»:Ñ.EÑ FÑGÐGr   c                 ó@   — t        | «      } t        t        | «      «      S )z7Convert uint64 to float32 value in the range [0.0, 1.0))r	   r   r4   r3   s    r   Úuint64_to_unit_float32r6   ˆ   s   € ô 	ˆq‹	€AÜÔ)¨!Ó,Ó-Ð-r   c                 óB   — t        |«      }t        t        | |«      «      S )zþReturn a float32 in range [0.0, 1.0) and advance ``states[index]``.

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: int64
    :param index: offset in states to update
    :rtype: float32
    )r   r6   r'   ©r   r   s     r   Úxoroshiro128p_uniform_float32r9   �   ó    € ô �%‹L€EÜ!Ô"4°V¸UÓ"CÓDÐDr   c                 óB   — t        |«      }t        t        | |«      «      S )zþReturn a float64 in range [0.0, 1.0) and advance ``states[index]``.

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: int64
    :param index: offset in states to update
    :rtype: float64
    )r   r4   r'   r8   s     r   Úxoroshiro128p_uniform_float64r<   �   r:   r   r)   c                 óð   — t        |«      }t        | |«      }t        | |«      }t        j                  t	        d«       t        j
                  |«      z  «      t        j                  t        |z  «      z  }|S )a–  Return a normally distributed float32 and advance ``states[index]``.

    The return value is drawn from a Gaussian of mean=0 and sigma=1 using the
    Box-Muller transform.  This advances the RNG sequence by two steps.

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: int64
    :param index: offset in states to update
    :rtype: float32
    ç       @)r   r9   ÚmathÚsqrtr   ÚlogÚcosÚTWO_PI_FLOAT32©r   r   Úu1Úu2Úz0s        r   Úxoroshiro128p_normal_float32rH   ¯   ó`   € ô �%‹L€Eä	& v¨uÓ	5€BÜ	& v¨uÓ	5€Bä	�‰”G˜C“L�=¤4§8¡8¨B£<Ñ/Ó	0´4·8±8¼NÈRÑ<OÓ3PÑ	P€Bð €Ir   c                 óð   — t        |«      }t        | |«      }t        | |«      }t        j                  t	        d«       t        j
                  |«      z  «      t        j                  t        |z  «      z  }|S )a–  Return a normally distributed float32 and advance ``states[index]``.

    The return value is drawn from a Gaussian of mean=0 and sigma=1 using the
    Box-Muller transform.  This advances the RNG sequence by two steps.

    :type states: 1D array, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type index: int64
    :param index: offset in states to update
    :rtype: float64
    r>   )r   r9   r?   r@   r   rA   rB   ÚTWO_PI_FLOAT64rD   s        r   Úxoroshiro128p_normal_float64rL   È   rI   r   c                 óü   — | j                   d   }t        |«      }t        |«      }|dk\  rRt        | d|«       t        |«      D ]  }t	        | d«       Œ t        d|«      D ]  }| |dz
     | |<   t	        | |«       Œ y y )Nr   r*   )Úshaper	   r   r+   r/   )r   r   Úsubsequence_startÚnÚ_r-   s         r   Úinit_xoroshiro128p_states_cpurR   á   s…   € à�‰�Q‰€AÜ�$‹<€DÜÐ0Ó1ÐàˆA‚vÜ  ¨¨DÔ1ô Ð(Ö)ˆAÜ˜v qÕ)ð *ô �q˜!–ˆAØ˜q 1™u™ˆF�1‰IÜ˜v qÕ)ñ ð r   c                 óŽ   — t        j                  | j                  t        ¬«      }t	        |||«       | j                  ||¬«       y)aµ  Initialize RNG states on the GPU for parallel generators.

    This initializes the RNG states so that each state in the array corresponds
    subsequences in the separated by 2**64 steps from each other in the main
    sequence.  Therefore, as long no CUDA thread requests more than 2**64
    random numbers, all of the RNG states produced by this function are
    guaranteed to be independent.

    The subsequence_start parameter can be used to advance the first RNG state
    by a multiple of 2**64 steps.

    :type states: 1D DeviceNDArray, dtype=xoroshiro128p_dtype
    :param states: array of RNG states
    :type seed: uint64
    :param seed: starting seed for list of generators
    )rN   Údtype)ÚstreamN)ÚnpÚemptyrN   Úxoroshiro128p_dtyperR   Úcopy_to_device)r   r   rO   rU   Ú
states_cpus        r   Úinit_xoroshiro128p_statesr[   ô   s9   € ô& —‘ §¡Ô4GÔH€JÜ! *¨dÐ4EÔFà
×Ñ˜*¨VÐÕ4r   c                 óZ   — t        j                  | t        |¬«      }t        ||||«       |S )a5  Returns a new device array initialized for n random number generators.

    This initializes the RNG states so that each state in the array corresponds
    subsequences in the separated by 2**64 steps from each other in the main
    sequence.  Therefore, as long no CUDA thread requests more than 2**64
    random numbers, all of the RNG states produced by this function are
    guaranteed to be independent.

    The subsequence_start parameter can be used to advance the first RNG state
    by a multiple of 2**64 steps.

    :type n: int
    :param n: number of RNG states to create
    :type seed: uint64
    :param seed: starting seed for list of generators
    :type subsequence_start: uint64
    :param subsequence_start:
    :type stream: CUDA stream
    :param stream: stream to run initialization kernel on
    )rT   rU   )r   Údevice_arrayrX   r[   )rP   r   rO   rU   r   s        r   Úcreate_xoroshiro128p_statesr^     s-   € ô* ×Ñ˜qÔ(;ÀFÔK€FÜ˜f dÐ,=¸vÔFØ€Mr   )r   r   )$r?   Únumbar   r   r   r   r   r   r	   r
   r   ÚnumpyrV   rT   rX   Úxoroshiro128p_typeÚENABLE_CUDASIMÚ	_forceobjÚ	_loopliftÚ	_nopythonr   r!   r'   r/   r4   r6   r9   r<   ÚpirC   rK   rH   rL   rR   r[   r^   © r   r   Ú<module>rh      s  ðÛ ÷$÷ $õ $ó ð4 �b—h‘h  r§y¡yÐ 1°D¸"¿)¹)Ð3DÐEØ%)ô+Ð áÐ 3Ó4Ð ð ×-Ñ-Ð -€	ˆIØ×%Ñ%Ð%€	ñ ˆi )°iÔ@ñó Aðñ2 ˆi )°iÔ@ñ,ó Að,ñ ˆi )°iÔ@ñó Aðñ* ˆi )°iÔ@ñó Aðñ4 ˆi )°iÔ@ñHó AðHñ ˆi )°iÔ@ñ.ó Að.ñ ˆi )°iÔ@ñ
Eó Að
Eñ ˆi )°iÔ@ñ
Eó Að
Eð �—‘˜A §¡™KÓ(€Ø�—‘˜A §¡™KÓ(€ñ ˆi )°iÔ@ñó Aðñ0 ˆi )°iÔ@ñó Aðñ0 ˆi )°iÔ@ñ*ó Að*ó$5ô2r   