+
    :i5                     6   R t ^ RIHt ^ RIHt ^ RItRtRtRt	 ! R R]
4      t ! R R]4      t ! R	 R
]4      tR tR tR tR tRR lt]R 4       tR t]P,                  RR3R lt]P,                  RR3R ltR tR tR tRR ltR tR R ltR tR t R t!R# )!zz
The Device Array API is not implemented in the simulator. This module provides
stubs to allow tests to import correctly.
)contextmanager)numpy_versionNzArray contains non-contiguous buffer and cannot be transferred as a single memory region. Please ensure contiguous buffer with numpy .ascontiguousarray()c                   6   a a ] tR t^t oRtV 3R ltRtVtV ;t# )	FakeShapez
The FakeShape class is used to provide a shape which does not allow negative
indexing, similar to the shape in CUDA Python. (Numpy shape arrays allow
negative indexing)
c                z   < \        V\        4      '       d   V^ 8  d   \        R4      h\        \        V `  V4      # )    ztuple index out of range)
isinstanceint
IndexErrorsuperr   __getitem__)selfk	__class__s   &&f/var/www/html/photoedit/myenv/lib/python3.14/site-packages/numba/cuda/simulator/cudadrv/devicearray.pyr   FakeShape.__getitem__   s4    a!a%788Y1!44     )	__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r   r      s     5 5r   r   c                   T   a  ] tR t^"t o RtR tR tR tR tR t	R t
R tR	 tR
tV tR# )FakeWithinKernelCUDAArraya/  
Created to emulate the behavior of arrays within kernels, where either
array.item or array['item'] is valid (that is, give all structured
arrays `numpy.recarray`-like semantics). This behaviour does not follow
the semantics of Python and NumPy with non-jitted code, and will be
deprecated and removed.
c                R    \        V\        4      '       g   Q hWP                  R &   R# )_itemN)r   FakeCUDAArray__dict__r   items   &&r   __init__"FakeWithinKernelCUDAArray.__init__+   s!    $....!%gr   c                H    \        V\        4      '       d   \        V4      # V# N)r   r!   r   r#   s   &&r   __wrap_if_fake(FakeWithinKernelCUDAArray.__wrap_if_fake/   s    dM**,T22Kr   c                t    V\        V P                  P                  4      9   d0   V P                  \	        V P                  P                  V4      4      # V P                  V P                  P                  V4      4      #   \         d.   p\        T\        4      '       g   \        T4      Th R p?R # R p?ii ; ir(   )	dirr    _ary(_FakeWithinKernelCUDAArray__wrap_if_fakegetattrr   	Exceptionr   AttributeError)r   attrnamees   && r   __getattr__%FakeWithinKernelCUDAArray.__getattr__5   s    	63tzz//**74::??H+MNN**4::+A+A(+KLL 	6a00$X.A5 1	6s   AA? )A? ?B7
"B22B7c                <    V P                   P                  W4       R # r(   r    __setitem__)r   nmvals   &&&r   __setattr__%FakeWithinKernelCUDAArray.__setattr__?   s    

r'r   c                V    V P                  V P                  P                  V4      4      # r(   )r.   r    r   )r   idxs   &&r   r   %FakeWithinKernelCUDAArray.__getitem__B   s"    ""4::#9#9##>??r   c                <    V P                   P                  W4       R # r(   r7   r   r>   r:   s   &&&r   r8   %FakeWithinKernelCUDAArray.__setitem__E   s    

s(r   c                ,    \        V P                  4      # r(   )lenr    r   s   &r   __len__!FakeWithinKernelCUDAArray.__len__H   s    4::r   c                0  a \        W4      pR  oVP                  R4      pV'       d6   \        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      VR&   \        ;QJ d    . V3R lV 4       F  NK  	  5M! V3R lV 4       4      pV! V/ VB # )c                 ^    \        V \        4      '       d   V P                  P                  p V # r(   )r   r   r    r-   objs   &r   convert_fakes@FakeWithinKernelCUDAArray.__array_ufunc__.<locals>.convert_fakesU   s"    #899iinnJr   outc              3   4   <"   T F  pS! V4      x  K  	  R # 5ir(   r   ).0orL   s   & r   	<genexpr><FakeWithinKernelCUDAArray.__array_ufunc__.<locals>.<genexpr>]   s     !@Cq-"2"2C   c              3   4   <"   T F  pS! V4      x  K  	  R # 5ir(   r   )rP   arL   s   & r   rR   rS   ^   s     4t!]1%%trT   )r/   gettuple)r   ufuncmethodargskwargscallrN   rL   s   &&&*,  @r   __array_ufunc__)FakeWithinKernelCUDAArray.__array_ufunc__K   sw     u%	 jj!E!@C!@EE!@C!@@F5Mu4t4uu4t44T$V$$r   r   N)r   r   r   r   r   r%   r.   r4   r;   r   r8   rF   r^   r   r   r   s   @r   r   r   "   s8     &6(@)% %r   r   c                   4  a  ] tR t^bt o RtRtR'R lt]R 4       t]R 4       t	R t
R'R lt]R 4       tR(R
 ltR tR tR)R ltR'R lt]R 4       tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t'R'R% lt(R&t)V t*R	# )*r!   z^
Implements the interface of a DeviceArray/DeviceRecord, but mostly just
wraps a NumPy array.
Tc                    Wn         W n        R # r(   r-   streamr   aryrd   s   &&&r   r%   FakeCUDAArray.__init__j   s    	r   c                .    V P                   P                  # r(   r-   nbytesrE   s   &r   
alloc_sizeFakeCUDAArray.alloc_sizen   s    yyr   c                .    V P                   P                  # r(   ri   rE   s   &r   rj   FakeCUDAArray.nbytesr   s     yyr   c                     \        V P                  V4      pV#   \         d   pR T,          p\        T4      ThRp?ii ; i)z#Wrapped array has no attribute '%s'N)r/   r-   r1   )r   r2   attrr3   msgs   &&   r   r4   FakeCUDAArray.__getattr__w   sC    	-499h/DK 	-7(BC %1,	-s    ?:?c                .    \        V P                  V4      # r(   r!   r-   )r   rd   s   &&r   bindFakeCUDAArray.bind   s    TYY//r   c                "    V P                  4       # r(   )	transposerE   s   &r   TFakeCUDAArray.T   s    ~~r   Nc                X    \        \        P                  ! V P                  VR 7      4      # ))axes)r!   nprx   r-   )r   r|   s   &&r   rx   FakeCUDAArray.transpose   s    R\\$))$?@@r   c                    V P                   P                  V4      p\        V4      \        P                  \        P
                  39  d   V# \        W P                  R 7      # )rd   )r-   r   typer}   ndarrayvoidr!   rd   )r   r>   rets   && r   r   FakeCUDAArray.__getitem__   sC    ii##C(9RZZ11J [[99r   c                8    V P                   P                  W4      # r(   )r-   r8   rA   s   &&&r   r8   FakeCUDAArray.__setitem__   s    yy$$S..r   c                    Vf"   \         P                  ! V P                  4      pM\        W4       \         P                  ! WP                  4       V# r(   )r}   
empty_liker-   check_array_compatibilitycopytore   s   &&&r   copy_to_hostFakeCUDAArray.copy_to_host   s6    ;--		*C%d0
		#yy!
r   c                |   \        V 4       \        V 4      \        V4      rC\        V\        4      '       d   \        V4       \	        W44       MM\
        P                  ! TVP                  R,          '       d   RMRR\        R8  d   RMRR7      p\	        W44       \
        P                  ! VP                  V4       R# )	z
Copy from the provided array into this array.

This may be less forgiving than the CUDA Python implementation, which
will copy data up to the length of the smallest of the two arrays,
whereas this expects the size of the arrays to be equal.
C_CONTIGUOUSCFTFN)ordersubokcopy   r   )sentry_contiguous
array_corer   r!   r   r}   arrayflagsr   r   r-   )r   rf   rd   	self_coreary_cores   &&&  r   copy_to_deviceFakeCUDAArray.copy_to_device   s     	$(.
38c=))c"%i:xx&__^<<c#+f4U$	@H
 &i:
		)..(+r   c                @    \        V P                  P                  4      # r(   )r   r-   shaperE   s   &r   r   FakeCUDAArray.shape   s    ))r   c                L    \        V P                  P                  ! V/ VB 4      # r(   )r!   r-   ravelr   r[   r\   s   &*,r   r   FakeCUDAArray.ravel   s    TYY__d=f=>>r   c                L    \        V P                  P                  ! V/ VB 4      # r(   )r!   r-   reshaper   s   &*,r   r   FakeCUDAArray.reshape   s!    TYY..??@@r   c                L    \        V P                  P                  ! V/ VB 4      # r(   )r!   r-   viewr   s   &*,r   r   FakeCUDAArray.view   s    TYY^^T<V<==r   c                B    V P                   P                  P                  # r(   )r-   r   c_contiguousrE   s   &r   is_c_contiguousFakeCUDAArray.is_c_contiguous       yy+++r   c                B    V P                   P                  P                  # r(   )r-   r   f_contiguousrE   s   &r   is_f_contiguousFakeCUDAArray.is_f_contiguous   r   r   c                ,    \        V P                  4      # r(   )strr-   rE   s   &r   __str__FakeCUDAArray.__str__       499~r   c                ,    \        V P                  4      # r(   )reprr-   rE   s   &r   __repr__FakeCUDAArray.__repr__   s    DIIr   c                ,    \        V P                  4      # r(   )rD   r-   rE   s   &r   rF   FakeCUDAArray.__len__   r   r   c                2    \        V P                  V8H  4      # r(   rt   r   others   &&r   __eq__FakeCUDAArray.__eq__       TYY%/00r   c                2    \        V P                  V8g  4      # r(   rt   r   s   &&r   __ne__FakeCUDAArray.__ne__   r   r   c                2    \        V P                  V8  4      # r(   rt   r   s   &&r   __lt__FakeCUDAArray.__lt__       TYY.//r   c                2    \        V P                  V8*  4      # r(   rt   r   s   &&r   __le__FakeCUDAArray.__le__   r   r   c                2    \        V P                  V8  4      # r(   rt   r   s   &&r   __gt__FakeCUDAArray.__gt__   r   r   c                2    \        V P                  V8  4      # r(   rt   r   s   &&r   __ge__FakeCUDAArray.__ge__   r   r   c                :    \        V P                  V,           4      # r(   rt   r   s   &&r   __add__FakeCUDAArray.__add__       TYY.//r   c                :    \        V P                  V,
          4      # r(   rt   r   s   &&r   __sub__FakeCUDAArray.__sub__   r   r   c                :    \        V P                  V,          4      # r(   rt   r   s   &&r   __mul__FakeCUDAArray.__mul__   r   r   c                :    \        V P                  V,          4      # r(   rt   r   s   &&r   __floordiv__FakeCUDAArray.__floordiv__       TYY%/00r   c                :    \        V P                  V,          4      # r(   rt   r   s   &&r   __truediv__FakeCUDAArray.__truediv__   r   r   c                :    \        V P                  V,          4      # r(   rt   r   s   &&r   __mod__FakeCUDAArray.__mod__   r   r   c                :    \        V P                  V,          4      # r(   rt   r   s   &&r   __pow__FakeCUDAArray.__pow__   r   r   c           	         \         P                  ! V P                  \        V\	        V 4      V4      4       Uu. uF  p\        V4      NK  	  up# u upi r(   )r}   splitr-   rangerD   r!   )r   sectionrd   rV   s   &&& r   r   FakeCUDAArray.split   sJ     XXdiiwD	7)KL
L !L
 	
 
s   Arc   r   r(   )Nr   )+r   r   r   r   r   __cuda_ndarray__r%   propertyrk   rj   r4   ru   ry   rx   r   r8   r   r   r   r   r   r   r   r   r   r   rF   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r`   s   @r   r!   r!   b   s     
         -0    A:/,, * *?A>,,
1101010001001
 
r   r!   c                    V P                   '       d   V P                  '       g   V # . pV P                    F&  pTP                  V^ 8X  d   ^ M
\        R4      4       K(  	  V \	        V4      ,          # )a/  
Extract the repeated core of a broadcast array.

Broadcast arrays are by definition non-contiguous due to repeated
dimensions, i.e., dimensions with stride 0. In order to ascertain memory
contiguity and copy the underlying data from such arrays, we must create
a view without the repeated dimensions.

N)stridessizeappendslicerX   )rf   
core_indexstrides   &  r   r   r      sW     ;;;chhh
J++v{!d< uZ !!r   c                    V P                   P                  p\        \        V P                  4      \        V P
                  4      4       F(  w  r#V^8  g   K  V^ 8w  g   K  W8w  d    R# W,          pK*  	  R# )z
Returns True iff `ary` is C-style contiguous while ignoring
broadcasted and 1-sized dimensions.
As opposed to array_core(), it does not call require_context(),
which can be quite expensive.
FT)dtypeitemsizezipreversedr   r   )rf   r   r   r   s   &   r   is_contiguousr    sZ     99DXcii0(3;;2GH191~MD	 I
 r   c                     \        V 4      pVP                  R ,          '       g+   VP                  R,          '       g   \        \        4      hR# R# )r   F_CONTIGUOUSN)r   r   
ValueErrorerrmsg_contiguous_buffer)rf   cores   & r   r   r     s=    c?D::n%%djj.H.H122 /I%r   c                    V P                  4       VP                  4       r2V P                  VP                  8w  d(   \        R V P                  : RVP                  : 24      hVP                  VP                  8w  d(   \	        RV P                  : RVP                  : 24      hVP
                  VP
                  8w  d(   \	        RV P
                  : RVP
                  : 24      hR# )zincompatible dtype: z vs. zincompatible shape: zincompatible strides: N)squeezer   	TypeErrorr   r  r   )ary1ary2ary1sqary2sqs   &&  r   r   r   %  s    \\^T\\^FzzTZZTZZ1 2 	2||v||#**djj2 3 	3~~',,6 7 	7 (r   c           	         \         P                  ! T \        R	8  d   RMRRR7      p \        V 4       Vf   V P                  P
                  R9   d   \         P                  MV P                  p\        \         P                  ! \         P                  ! \        V 4      4      P                  V4      V P                  V P                  V P                  R7      P                  \        V 4      R7      4      # VP                  WR7       R# )
r   FNTr   r   Mm)bufferr   r   r   )r   r   r   )r}   r   r   r   r   charint64r!   r   r   r   r   r   r   r   r   )rf   rd   r   tobuffer_dtypes   &&&& r   	to_devicer  2  s    
((3!.!7TC c	z#&99>>T#9rxxsyyJJwwz#/44\Biiii	
 dS	d"
 	
 	#-r   c              #      "   R x  R # 5ir(   r   )args   &r   pinnedr  E  s     	s   	c                  \    R F  pW!9   g   K  VP                  V4       K  	  \        V / VB # )portable)r  wc)popdevice_array)r[   r\   
unused_args   *, r   mapped_arrayr   J  s0    (
JJz" ) (((r   r   c                 2    \         P                  ! WWR 7      # )r   r   r   r   r}   r   r   r   r   r   s   &&&&r   pinned_arrayr%  Q      ::E%MMr   c                 2    \         P                  ! WWR 7      # r"  r#  r$  s   &&&&r   managed_arrayr(  U  r&  r   c                  x    R V9   d   VP                  R 4      M^ p\        \        P                  ! V / VB VR7      # )rd   r   )r  r!   r}   r   )r[   r\   rd   s   *, r   r  r  Y  s4    %-%7VZZ!QFT4V4VDDr   c                   V P                   R,          '       g+   V P                   R,          '       g   V P                  ^8:  d   R# \        V P                  4       Uu. uF  qNK  	  ppVP	                  R R7       ^ .\        V P                  4      ,          pV P                  P                  pV F"  w  rVWCV&   W@P                  V,          ,          pK$  	  \        V4      # u upi )zO
Given an array, compute strides for a new contiguous array of the same
shape.
r   r  Nc                     V ^,          # )   r   )xs   &r   <lambda>0_contiguous_strides_like_array.<locals>.<lambda>p  s    !A$r   )key)
r   ndim	enumerater   sortrD   r   r   r   rX   )rf   r-  
stridepermr   r   i_perm_s   &      r   _contiguous_strides_like_arrayr7  ^  s     yy  CIIn$=$=Q (46414J6OOO' cC$$GYYF	 ))F##   > 7s   
C"c                 n    V P                   R ,          '       d   V P                   R,          '       g   R# R# )r  r   r   r   )r   )rf   s   &r   _order_like_arrayr9  {  s%    
yy  >)B)Br   c                 t    \        V 4      p\        V 4      p\        V P                  V P                  VVR 7      # r$  )r7  r9  r  r   r   )rf   rd   r   r   s   &&  r   device_array_liker<    4    ,S1Gc"Eciisyy'#% %r   c                 t    \        V 4      p\        V 4      p\        V P                  V P                  VVR 7      # r;  )r7  r9  r%  r   r   )rf   r   r   s   &  r   pinned_array_liker?    r=  r   c                     \        V \        4      '       d   V R 3# \        V \        P                  4      '       g'   \        P                  ! T \
        R8  d   R MRRR7      p \        WV4      R3# )FNTr  r   )r   r!   r}   r   r   r   r  )rf   rd   r   s   &&&r   auto_devicerA    s^    #}%%Ezc277##hh'&0d S$'--r   c                    \        V RR4      # )z$Check if an object is a CUDA ndarrayr   F)r/   rJ   s   &r   is_cuda_ndarrayrC    s    3*E22r   c                   a  \        S 4       V 3R lpV! R\        4       V! R\        4       V! R\        P                  4       V! R\        4       R# )z,Verify the CUDA ndarray interface for an objc                    < \        SV 4      '       g   \        V 4      h\        \        SV 4      V4      '       g   \        V : R V: 24      hR# )z must be of type N)hasattrr1   r   r/   )rp   typrK   s   &&r   requires_attr4verify_cuda_ndarray_interface.<locals>.requires_attr  sD    sD!! &&'#t,c22 D#!FGG 3r   r   r   r   r   N)require_cuda_ndarrayrX   r}   r   r	   )rK   rH  s   f r   verify_cuda_ndarray_interfacerK    s?    H '5!)U#'288$&#r   c                >    \        V 4      '       g   \        R4      hR# )z9Raises ValueError is is_cuda_ndarray(obj) evaluates Falsezrequire an cuda ndarray objectN)rC  r  rJ   s   &r   rJ  rJ    s    39::  r   )r   TNr   )r   T)"r   
contextlibr   numba.np.numpy_supportr   numpyr}   DeviceRecordfrom_record_liker  rX   r   objectr   r!   r   r  r   r   r  r  r   float64r%  r(  r  r7  r9  r<  r?  rA  rC  rK  rJ  r   r   r   <module>rT     s    & 0   3 
5 
5=% =%@X
F X
v"$ 3
7.& 
 
) !jj$c N  "zz4s NE
:%%	.3
 ;r   