
    sh9              	           S SK r S SKJrJrJrJrJr  S SKJr  \\\" S5      \" S5       " S S\5      5       5       5       5       r	\
S:X  a  \ R                  " 5         gg)	    N)CUDATestCaseskip_if_cudadevrt_missingskip_on_cudasimskip_unless_cc_60skip_if_mvc_enabled)captured_stdoutzCG not supported with MVCz4cudasim doesn't support cuda import at non-top-levelc                   >   ^  \ rS rSrSrU 4S jrU 4S jrS rSrU =r	$ )TestLaplace	   z
Test simple vector addition
c                 t   > [        5       U l        U R                  R                  5         [        TU ]  5         g N)r   _captured_stdout	__enter__supersetUpself	__class__s    ~/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/cuda/tests/doc_examples/test_laplace.pyr   TestLaplace.setUp   s)     / 1'')    c                 \   > U R                   R                  S S S 5        [        TU ]  5         g r   )r   __exit__r   tearDownr   s    r   r   TestLaplace.tearDown   s&    &&tT48r   c                 l  ^ SnSS K nSSKJm  SnUR                  U5      nSUS'   TR	                  U5      nTR                  U5      nSnU(       a  SS KJn  UR                  SS9u  pUR                  UR                  [        U5      5      UR                  5       S	S
SS9  UR                  SSS9  UR                  SSS9  UR                  SSS9  U
R!                  U
R#                  5       SS9  U
R%                  U
R'                  5       SS9  UR)                  S[        U5      5        UR+                  SS5        UR-                  S5        TR.                  U4S j5       nUR1                  [        U5      5      " XVUS5        UR                  5       nU(       a  WR                  SS9u  pUR                  UR                  [        U5      5      US	S
SS9  UR                  SU 3SS9  UR                  SSS9  UR                  SSS9  U
R!                  U
R#                  5       SS9  U
R%                  U
R'                  5       SS9  UR+                  S[3        U5      5        UR)                  S[        U5      5        UR-                  S5        UR4                  R7                  UR9                  5       S5        g )NFr   )cudai  i'  i  )gQ%@g(\@)figsize   *black)lwmarkercolorzInitial State   )fontsizePositionTemperature   i'  zlaplace_initial.svgc                   > TR                  S5      nU[        U 5      :  a  g TR                  R                  5       n[	        U5       H  nUS-  S:X  a  U nUnOUnU nXt   n	US:X  a  XXtS-      SU	-  -
  -  -   n
O?U[        U5      S-
  :X  a  XXtS-
     SU	-  -
  -  -   n
OXXtS-
     SU	-  -
  XtS-      -   -  -   n
XU'   UR                  5         M     g )N      r   )gridlencg	this_gridrangesync)buf_0buf_1	timestepskir-   stepdata	next_data	curr_temp	next_tempr   s              r   solve_heat_equation8TestLaplace.test_ex_laplace.<locals>.solve_heat_equationN   s    		!A CJ 77$$&Di(1H? D %I D %I !G	 6 )!eI1N,O OI#d)a-' )!eI1N,O OI !*Uq9}5UC- !I
  )! 		; )r   g      ?zT = zlaplace_final.svg)numpynumbar   zeros	to_devicedevice_array_likematplotlib.pyplotpyplotsubplotsplotaranger.   copy_to_hosttitlexlabelylabel
set_xticks
get_xticks
set_yticks
get_yticksxlimylimsavefigjitforallmaxtestingassert_allclosesum)r   rG   npsizer9   r3   r4   niterpltfigaxr=   resultsr   s                @r   test_ex_laplaceTestLaplace.test_ex_laplace   sn     	 xx~ S	t$ &&u- +ll+@lAGCHH		#e*%""$   IIoI3JJzBJ/JJ}rJ2MM"--/BM7MM"--/BM7HHQD	"HHQKK-. 
'	 
'	V 	""3t9-%	

 $$&ll+@lAGCHH		#g,'A	   IIUGnrI2JJzBJ/JJ}rJ2MM"--/BM7MM"--/BM7HHQG%HHQG%KK+, 	

""7;;=%8r   )r   )
__name__
__module____qualname____firstlineno____doc__r   r   ra   __static_attributes____classcell__)r   s   @r   r
   r
   	   s    

z9 z9r   r
   __main__)unittestnumba.cuda.testingr   r   r   r   r   numba.tests.supportr   r
   rc   main r   r   <module>rp      ss    5 5 0 01GHJ9, J9 I 2  J9Z zMMO r   