
    xKg+                       d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZ	d dl
Z
d dlmZ d dlZd dlmZ d dlZd dlmZmZ d dlZd dlmZmZ d dlZd dlZd dlmZmZmZmZm Z m!Z!m"Z"m#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-m.Z.m/Z/ d d	l0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6 d d
l7m8Z8 d dl9m:Z: d dl;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZB d dlCmDZE d dlFmGZGmHZH d dlImJZJmKZK d dlLmMZM d dlNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\ d dl]m^Z^ d dl_m`Z` d dl$maZa d dlbZbd dlcZceU G d deO             Zd ecj                   ej                         dvd      ZgdZhdZi edd      Zjd Zke[ G d deO             Zld  Zmd! Znd" Zod# Zpd$ Zqd% Zrd& Zsd' Ztd( Zud) Zvd* ZwdUd+Zxd, Zy G d- d.ez      Z{eU G d/ d0el             Z|eU G d1 d2el             Z}eU G d3 d4el             Z~ G d5 d6eO      ZeU G d7 d8el             ZeU G d9 d:eQel             ZeU G d; d<el             ZeU G d= d>el             ZeU G d? d@el             ZeU G dA dBel             ZeU G dC dDel             Z G dE dFel      ZeU G dG dHe             Ze^dI        ZeU G dJ dKe             ZeU G dL dMeO             ZeUeg G dN dOe                    ZeU G dP dQeO             ZeU G dR dSeO             ZedTk(  r ecj                           yy)V    Nreducerandn)defaultdict
namedtuple)cyclechain)njitprangeparallel_chunksizeget_parallel_chunksizeset_parallel_chunksizeset_num_threadsget_num_threadstypeof)	typeserrorsirrewritestyped_passesinline_closurecallconfigcompilercpu)DictList)overload_methodregister_modeltypeof_implunboxNativeValuemodels)
cpu_target)type_annotations)find_callnameguardbuild_definitionsget_definition
is_getitem
is_setitemindex_var_of_get_setitem)empty_inferred)CompilerBaseDefaultPassBuilder)register_passAnalysisPass)IRLegalization)TestCasecaptured_stdoutMemoryLeakMixinoverride_env_config
linux_onlytagskip_parfors_unsupported_32bit
needs_blasneeds_lapackdisabled_testskip_unless_scipyneeds_subprocessskip_ppc64le_invalid_ctr_loop)register_jitable)_fix_LOAD_GLOBAL_arg)utilsc                       e Zd ZdZ ej
                         dk7  rdndZ	 d Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zy)TestParforsRunnerFaarch64i  i  c                     | j                   }| j                         j                  d      d   j                  d      d   }| j                  ||| j                         y )N._)test_module
test_classtimeout)
__module__idsplitsubprocess_test_runner_TIMEOUT)selfthemodtest_clazz_names      \/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/tests/test_parfors.pyrunnerzTestParforsRunner.runnerQ   sS    '')//#.r288=bA##/>,0MM 	$ 	;    c                 $    | j                          y NrW   rS   s    rV   test_TestParforBasicz&TestParforsRunner.test_TestParforBasicY       rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforNumericalMiscz.TestParforsRunner.test_TestParforNumericalMisc\   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforNumPyz&TestParforsRunner.test_TestParforNumPy_   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsz"TestParforsRunner.test_TestParforsb   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsBitMaskz)TestParforsRunner.test_TestParforsBitMaske   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsDiagnosticsz-TestParforsRunner.test_TestParforsDiagnosticsh   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsLeaksz'TestParforsRunner.test_TestParforsLeaksk   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsMiscz&TestParforsRunner.test_TestParforsMiscn   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsOptionsz)TestParforsRunner.test_TestParforsOptionsq   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsSlicez'TestParforsRunner.test_TestParforsSlicet   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestParforsVectorizerz,TestParforsRunner.test_TestParforsVectorizerw   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestPrangeBasicz&TestParforsRunner.test_TestPrangeBasicz   r^   rX   c                 $    | j                          y rZ   r[   r\   s    rV   test_TestPrangeSpecificz)TestParforsRunner.test_TestPrangeSpecific}   r^   rX   N)__name__rN   __qualname___numba_parallel_test_platformmachinerR   rW   r]   r`   rb   rd   rf   rh   rj   rl   rn   rp   rr   rt   rv    rX   rV   rE   rE   C   sp     " (x'')Y6tDH
;rX   rE   )i386x86_64zx86 only test      TestNamedTuplepart0part1c                      y)z
    Used with check_arq_equality to indicate that we do not care
    whether the value of the parameter at the end of the function
    has a particular value.
    Nr|   abs     rV   null_comparerr      s     	rX   c                       e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZddZddZd Zd Zd Zd Zy)TestParforsBasez
    Base class for testing parfors.
    Provides functions for compilation and three way comparison between
    python functions, njit'd functions and parfor njit'd functions.
    Fc                 @     t        |fi ||      j                  |   S rZ   )r   	overloads)rS   funcsigflagss       rV   _compile_thiszTestParforsBase._compile_this   s&     "tC!5!$'11#66rX   c                 *    | j                  ||d      S )NTparallelr   rS   r   r   s      rV   compile_parallelz TestParforsBase.compile_parallel   s    !!$d!;;rX   c                 ,    | j                  ||dd      S )NT)r   fastmathr   r   s      rV   compile_parallel_fastmathz)TestParforsBase.compile_parallel_fastmath   s    !!$dT!JJrX   c                 &    | j                  ||      S rZ   r   r   s      rV   compile_njitzTestParforsBase.compile_njit   s    !!$,,rX   c                     t        |D cg c]  }t        j                  |       c}      }| j                  ||      }| j	                  ||      }||fS c c}w rZ   )tuplenumbar   r   r   )rS   pyfuncargskwargsxr   cpfunccfuncs           rV   compile_allzTestParforsBase.compile_all   sZ    d3dU\\!_d34 &&vs3 !!&#.f} 4s   Ac                    |j                  dd      }|j                  dd      }|j                  dd      }|j                  dd      }	|j                  dd      }
d } || } || } || } |j                  | } || } |j                  | }|
gt        j                  j                  ||fi | t        j                  j                  ||fi | | j                  t        |      t        |             nEt        |      t        |
      k(  sJ t        ||||
      D ]  \  }}}} |||fi |  |||fi |  |	r| j                  ||       |4 |j                   ||  }t        j                  j                  ||fi | yy)	a-  
        Checks python, njit and parfor impls produce the same result.

        Arguments:
            pyfunc - the python function to test
            cfunc - CompilerResult from njit of pyfunc
            cpfunc - CompilerResult from njit(parallel=True) of pyfunc
            args - arguments for the function being tested
        Keyword Arguments:
            scheduler_type - 'signed', 'unsigned' or None, default is None.
                           Supply in cases where the presence of a specific
                           scheduler is to be asserted.
            fastmath_pcres - a fastmath parallel compile result, if supplied
                             will be run to make sure the result is correct
            check_arg_equality - some functions need to check that a
                                 parameter is modified rather than a certain
                                 value returned.  If this keyword argument
                                 is supplied, it should be a list of
                                 comparison functions such that the i'th
                                 function in the list is used to compare the
                                 i'th parameter of the njit and parallel=True
                                 functions against the i'th parameter of the
                                 standard Python function, asserting if they
                                 differ.  The length of this list must be equal
                                 to the number of parameters to the function.
                                 The null comparator is available for use
                                 when you do not desire to test if some
                                 particular parameter is changed.
            Remaining kwargs are passed to np.testing.assert_almost_equal
        scheduler_typeNcheck_fastmathfastmath_pcrescheck_schedulingTcheck_arg_equalityc                  P   | s
t               S g }| D ]  }t        |t        j                        r!|j	                  |j                  d             ?t        |t        j                        r |j	                  |j                                yt        |t        j                        r|j	                  |       ||j	                  |       t        |t               r%|j	                  t        j                  |             t        |t              r|j	                  |d d         t        |t              r&|j	                  t        j
                  |             Jt        |t              r&|j	                  t        j
                  |             t        d       t        |      S )Nkz%Unsupported argument type encountered)r   
isinstancenpndarrayappendcopynumbernumbersNumberdeepcopylistr   r   
ValueError)r   new_argsr   s      rV   	copy_argsz:TestParforsBase.check_parfors_vs_others.<locals>.copy_args   s   wHa,OOAFF3K0299-OOAFFH-7>>2OOA&YOOA&5)OODMM!$454(OOAaD)4(OODIIaL14(OODIIaL1$%LMM% & ?"rX   )
popentry_pointr   testingassert_almost_equalassertEqualtypelenzipr   )rS   r   r   r   r   r   r   r   r   r   check_args_for_equalityr   py_argspy_expected	njit_argsnjit_outputparfor_argsparfor_outputpyargnjitarg	parforargargcompparfor_fastmath_outputs                          rV   check_parfors_vs_othersz'TestParforsBase.check_parfors_vs_others   s   >  $4d;$4d;$4d;!::&8$?"(**-A4"H	#4 T"g& t$	'e''3  &***K8"*JJ**;NvNJJ**=+PPT+.]0CDw<3'>#??@?69K1H7J2w	71&1	53F37J
 !!&.9 %%?^%?%?DAQ%R"JJ**+A; 5-35 &rX   c                 `     | j                   |g| \  }} | j                  |||g|i | y)zChecks that pyfunc compiles for *args under parallel=True and njit
        and asserts that all version execute and produce the same resultNr   r   rS   r   r   r   r   r   s         rV   checkzTestParforsBase.check  s=     )((7$7v$$$VUFLTLVLrX   c           	           |       D ]I  }| j                  t        t        t        |                  5   | j                  |g|i | ddd       K y# 1 sw Y   VxY w)zHRun self.check(impl, ...) on array data generated from arg_gen.
        N)subTestr   mapr   r   )rS   implarg_genr   r   s        rV   check_variantszTestParforsBase.check_variants  sO     IDd3vt#456

41$1&1 76 66s   AA	c           	           |       D ]h  }| j                  t        t        t        |                  5  t	        t        t        |            }| j                  t        ||      d       ddd       j y# 1 sw Y   uxY w)zXRun self.countParfors(impl, ...) on array types generated from
        arg_gen.
           N)r   r   r   r   r   assertGreaterEqualcountParfors)rS   r   r   r   r   argtyss         rV   count_parfors_variantsz&TestParforsBase.count_parfors_variants   s_     IDd3vt#456s6401''T6(BAF 76 66s   6A44A=	c                     d}||dv r	|d|z   z  }nd}t        ||z        | j                  ||j                  j                                y )Nz@do_scheduling)signedunsignedrJ   z$Unknown scheduler_type specified: %s)r   assertInlibraryget_llvm_str)rS   cresr   scheduler_strmsgs        rV   r   z TestParforsBase.check_scheduling*  sU    (%!77~!55< ~!566mT\\%>%>%@ArX   c                 |    fd}t         |             }t        |      D cg c]  }t        |       c}S c c}w )zFMake *ct* sample 1D arrays of length *n* using np.linspace().
        c               3      K   t        j                  dd        t        j                  dd        t        j                  dd        y wNr   r      r   linspacens   rV   genz)TestParforsBase.gen_linspace.<locals>.gen9  s@     ++aA&&++aA&&++aA&&s   AA)r	   rangenext)rS   r   ctr   srcis    `    rV   gen_linspacezTestParforsBase.gen_linspace6  s5    	'
 CEl#(9-9aS	9---s   9c              #     K   | j                  d|       | j                  d|      D cg c]  }|j                  d       }}| |D cg c]  }t        j                  |       c} | j                  d|      D cg c]  }|j                  d       }}| |D cg c]  }t        j                  |       c} yc c}w c c}w c c}w c c}w w)	z?Make 1D, 2D, 3D variants of the data in C and F orders
        
   )r      )r   r   r         )r   r      N)r   reshaper   asfortranarray)rS   r   r   arr2dsarr3dss        rV   gen_linspace_variantsz%TestParforsBase.gen_linspace_variantsA  s      r**  ,,u,<><a ))F#< 	 >-34Vr  #V44  ,,yR,@B@a ))I&@ 	 B-34Vr  #V44> 5B 5s4   +CC	
CC+CC
C'CCNc                 |    |D cg c]  }||j                   v s| }}||D ]  }|t        |      v rJ  |S c c}w )z. helper function to filter out modules by name)namestr)rS   modmagicstrcheckstrr   filts         rV   _filter_modzTestParforsBase._filter_modU  sM    53a(aff"4353q6))) 	 6s   99c                 @   |j                   j                  j                  j                  j                  D cg c]  }| }}| j                  |||      }|j                   j                         }g }|D ]"  }	|	j                  |v s|j                  |	       $ |S c c}w )z gets the gufunc LLVM Modules)r
  )	r   _codegen_engine_ee_modulesr  get_asm_strr  r   )
rS   r   r	  r
  r   r  potential_matcheslib_asmretr  s
             rV   _get_gufunc_modulesz#TestParforsBase._get_gufunc_modules]  s    #||44<<@@IIJI!AIJ !,,Xx6> - @ ,,**,$Cxx7"

3 % 
 Ks   	Bc                 z    d}| j                  ||      }t               }|D ]  } ||      ||j                  <    |S )z$ helper for gufunc IR/asm generation__numba_parfor_gufunc)r  dictr  )rS   r   fnr	  gufunc_modsr   r  s          rV   _get_gufunc_infoz TestParforsBase._get_gufunc_infol  sB     +..tX>FCS'AchhK rX   c                 .    | j                  |t              S )z
        Returns the IR of the gufuncs used as parfor kernels
        as a dict mapping the gufunc name to its IR.

        Arguments:
         cres - a CompileResult from `njit(parallel=True, ...)`
        )r  r  )rS   r   s     rV   _get_gufunc_irzTestParforsBase._get_gufunc_irv  s     $$T3//rX   c                 r    |j                   j                  j                  fd}| j                  ||      S )z
        Returns the assembly of the gufuncs used as parfor kernels
        as a dict mapping the gufunc name to its assembly.

        Arguments:
         cres - a CompileResult from `njit(parallel=True, ...)`
        c                 8    t        j                  |             S rZ   )r  emit_assembly)r  tms    rV   emit_asmz1TestParforsBase._get_gufunc_asm.<locals>.emit_asm  s    r'',--rX   )r   r  _tmr  )rS   r   r#  r"  s      @rV   _get_gufunc_asmzTestParforsBase._get_gufunc_asm  s2     \\""&&	.$$T844rX   c                       j                  ||      } j                  |      }d } fd}|j                         D ]  \  }} ||      }	 ||	        y)a  
        Asserts that the fastmath flag has some effect in that suitable
        instructions are now labelled as `fast`. Whether LLVM can actually do
        anything to optimise better now the derestrictions are supplied is
        another matter!

        Arguments:
         pyfunc - a function that contains operations with parallel semantics
         sig - the type signature of pyfunc
        c                      | j                          }g }|D ],  }t        j                  d|      }||j                  |       . |S )Nz\bfast\b)
splitlinesresearchr   )r   splitted	fast_instr   ms        rV   _get_fast_instructionsz?TestParforsBase.assert_fastmath.<locals>._get_fast_instructions  sI    $r}}HIIIk1-=$$Q'  rX   c                 p    d}| D ].  }d}|D ]  }|dz   }||v s|dz  } j                  |dkD         0 y )N)faddfsubfmulfdivfremfcmpcallr   z fastr   )
assertTrue)instrsopsinstcountopmatchrS   s         rV   _assert_fastz5TestParforsBase.assert_fastmath.<locals>._assert_fast  sL    JCBLE}
  	* rX   N)r   r  items)
rS   r   r   r   _irr.  r>  r  guirr:  s
   `         rV   assert_fastmathzTestParforsBase.assert_fastmath  sY     --fc:!!$'		+ ))+JD$)$/D &rX   rZ   )rw   rN   rx   __doc__ry   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r%  rB  r|   rX   rV   r   r      so     "7
<K-	\5|M2G
B	.5(05$rX   r   c                    t        j                  | |z        }d|z  |z  }|t        j                  |      z  }||z   |z  |z   |z  }||z
  }	dd|z  z   }
dd|	z  z   }|t        j                  | |z        z  }||z  }| |
z  |z
  }||z
  | z   }|S )N      ?      ?)r   logsqrtexp)sptpricestrikerate
volatilitytimevlogtermpowtermdend1d2NofXd1NofXd2futureValuec1r6  puts                   rV   blackscholes_implrY    s    ffX&'GJ+G
rwwu~
%C7Ne#w
.#	5B	cB9r>!F9r>!F266D&5.11K	v	Bfr!D

x
'CJrX   c                     t        |      D ]R  }|t        j                  ddt        j                  |  t        j                  ||      z        z   z  dz
  | z  |      z  }T |S NrF  )r   r   dotrI  )YXw
iterationsr   s        rV   lr_implra    sY    :	RVVcS2661"rvva|*;#<<=CqH1MM HrX   c                    |}| j                   \  }}t        |      D ]<  }t        j                  t        |      D 	cg c]U  }t        |      D 	cg c]>  }	t	        j
                  t        j                  | |d d f   ||	d d f   z
  dz              @ c}	W c}	}      }
t        j                  t        |      D cg c]  }|
|d d f   j                          c}      }t        j                  t        |      D 	cg c]O  }t        |      D 	cg c]8  }	t        j                  | ||k(  |	f         t        j                  ||k(        z  : c}	Q c}	}      }? |S c c}	w c c}	}w c c}w c c}	w c c}	}w Nr   )shaper   r   arraymathrH  sumargmin)A	numCenternumIterinit_centroids	centroidsNDlr   jdistlabelss               rV   example_kmeans_testrt    s\   I77DAq7^xxDI!HNDLqy)9;)9A ))BFFAacF9QqS>,AA+E$FG)9;DLN OuQx@x!4!9++-x@AHH=B9=MO=M%(4*2Q  "vva	1o6rvvfai7HH*24=MO P	  ; N@4 Os6   E$AEE$<E*
>E4=E/E4E$/E4c                    t         j                  }t         j                  }t        j                  |       }|rt        j                  |      }nt        j                  d      }t        ||||      }|j                          |j                          t        j                  |j                  j                  |d      }|j                          t        j                  j!                  d|j                         t#        j$                  |j                  j&                  |j                  j(                  |j                  j                  |j                  j*                  d       \  |j                  _        |j                  _        |j                  _        }	t3        j4                  |j                  j                  |j                  j,                  |j                  j0                  dd |j                  j*                  |j                  j.                  t6        j8                         t:        j<                  j>                  jA                         }
t:        j<                  j>                  jC                  |j                  j                  |j                  j,                  |j                  j0                  |j                  j&                  |j                  j(                  ||
jD                        }|j                          t        j                  j!                  d|j                         t        jF                         }t:        j<                  j>                  jI                  |j                  j                  |j                  j,                  |j                  j0                  |j                  j.                  |j                  j&                  |j                  j(                  |||j                  jJ                  |

      }|j                          t:        j<                  j>                  jM                  |j                  j                  |j                  j,                  |j                  j0                  |j                  j.                  |j                  j&                  |j                  j(                  |||j                  jJ                  |

      }|j                          t:        j<                  j>                  jO                  |j                  j                  |j                  j,                  |j                  j0                  |j                  j.                  |j                  j&                  |j                  j(                  |||j                  jJ                  |

      }|j                          tQ        |jR                        |_*        ||fS )	NT)typedzbefore-inferencer|   )func_irtypemap	calltypesliftedlifted_fromr   return_typehtml_output)swappedzafter-inference)diagnostics)+r$   typing_contexttarget_contextr   run_frontendr   ParallelOptionsTestPipelinerefreshr   InlineClosureCallPassstaterw  runr   rewrite_registryapplyr   type_inference_stage	typingctx	targetctxr   rx  r|  ry  r%   TypeAnnotationr   HTMLr   parforsparforParforDiagnosticsPreParforPassreplaced_fnsFlags
ParforPassmetadataParforFusionPassParforPreLoweringPassr(   blocks_definitions)	test_funcr   kwsr  r  test_iroptionstpinline_passrJ   r  preparfor_passr   parfor_passs                 rV   get_optimized_numba_irr    s   ))I))I##I.G
%%c*%%d+	iD'	:B$::288;K;K<CBFHK OO##$6A %%bhh&8&8
BHH,,bhhmmTC BBHHbhh*BHH,> ##    (($$XX]]HH((KK! --&&88:K]]))77
"((**BHH,>,>
BHH..(( 8 *N ##$5rxx@NNE--&&11
"((**BHH,>,>
bhh00"((2D2D)){ 2 DK OO--&&77
"((**BHH,>,>
bhh00"((2D2D)){ 8 DK OO--&&<<
"((**BHH,>,>
bhh00"((2D2D)){ = DK OO,W^^<GB;rX   c                    t        | |fi |\  }}d}|j                  j                         D ]V  \  }}t        |j                        D ]9  \  }}	t        |	t        j                  j                  j                        s5|dz  }; X |S Nr   r   )
r  r  r?  	enumeratebodyr   r   r  r  Parfor)
r  r   r  r  r  	ret_countlabelblockr   r:  s
             rV   r   r     sy    (D@C@KGRI,,.u ,GAt$ 4 4 ; ;<Q	 - /
 rX   c                 v    t        | |fi |\  }}t        |j                  |j                  j                        S rZ   )r  _count_arrays_innerr  r  rx  r  r   r  r  r  s        rV   countArraysr  %  s2    (D@C@KGRw~~rxx/?/?@@rX   c                 N   t        | |fi |\  }}|j                  }d}|j                         D ]s  \  }}t        |j                        D ]V  \  }	}
t        |
t        j                  j                  j                        s5|t        |
j                  j                        z  }X u |S Nr   )r  r  r?  r  r  r   r   r  r  r  r   
init_block)r  r   r  r  r  r  r  r  r  r   r:  s              rV   get_init_block_sizer  )  s    (D@C@KGR^^FIu ,GAt$ 4 4 ; ;<S!5!566	 - '
 rX   c                 T   d}t               }| j                         D ]  \  }}t        |j                        D ]  \  }}t	        |t
        j                  j                  j                        r8|j                  j                         }|j                  |d<   |t        ||      z  }t	        |t        j                        st	        ||j                  j                      t"        j$                        s|j'                  |j                  j                            |t)        |      z  }|S r  )setr?  r  r  r   r   r  r  r  	loop_bodyr   r  r  r   Assigntargetr  r   ArrayCompatibleaddr   )	r  rx  r  arr_setr  r  r   r:  parfor_blockss	            rV   r  r  6  s    IeGu ,GAt$ 4 4 ; ;< $ 3 3 5#'??a 0HH	4+"74;;+;+;#<$)$9$9;DKK,,- - ' WIrX   c                     t        | |fi |\  }}d}|j                  j                         D ]  }|t        ||      z  } |S r  )r  r  values_count_array_allocs_inner)r  r   r  r  r  r  r  s          rV   countArrayAllocsr  H  sM    (D@C@KGRI&&(.w>>	 ) rX   c                 T   d}|j                   D ]  }t        |t        j                  j                  j
                        rG|t        | |j                        z  }|j                  j                         D ]  }|t        | |      z  } t        |t        j                        st        |j                  t        j                        s|j                  j                  dk(  st        t         | |j                        dk(  s t        t         | |j                        dk(  s|dz  } |S )Nr   r6  )emptynumpy)r-   znumba.np.unsafe.ndarrayr   )r  r   r   r  r  r  r  r  r  r  r   r  valueExprr<  r'   r&   )rw  r  r  r:  r   s        rV   r  r  Q  s    I

dEMM0077827DOOLLI^^**,6wBB	 - tRYY'Jtzz277,KJJMMV+='4::>BTT<DENI  rX   c                 x    t        | |fi |\  }}t        ||j                  |j                  j                        S rZ   )r  &_count_non_parfor_array_accesses_innerr  r  rx  r  s        rV   countNonParforArrayAccessesr  b  s;    (D@C@KGR1'7>>24((2B2BD DrX   c           	         d}|
t               }|j                         D ]  \  }}|j                  D ]  }t        |t        j
                  j                  j                        r`|j                  |j                  j                         |j                  j                         }|j                  |d<   |t        | |||      z  }t        |      rWt        ||j                   j                   j                     t"        j$                        rt'        | t)        |      |      s|dz  }t+        |      rNt        ||j,                  j                     t"        j$                        rt'        | t)        |      |      s|dz  }Mt        |t.        j0                        sit        |j                   t.        j2                        s|j                   j                  |v s|j                  |j,                  j                           |S r  )r  r?  r  r   r   r  r  r  r  	index_varr  r  r   r  r  r*   r  r   r  _uses_indicesr,   r+   r  r   r  Var)	f_irr  rx  parfor_indicesr  r  r  stmtr  s	            rV   r  r  g  s   IuJJD$ 4 4 ; ;<""4>>#6#67 $ 3 3 5#'??a C-.B B	 T"z'$**:J:J:O:O2P--(/7D6t<n8NQ	 T"z'$++:J:J2K))(+3@248.4JQ	 T299-TZZ0**//^3""4;;#3#341  '6 rX   c                     |j                   |v ryt        t        | |      }t        |t        j
                        r<|j                  dk(  r-t        d |j                  D              }t        ||z        dk7  S y)NTbuild_tuplec              3   4   K   | ]  }|j                     y wrZ   )r  ).0vs     rV   	<genexpr>z _uses_indices.<locals>.<genexpr>  s     5}!qvv}s   r   F)
r  r'   r)   r   r   r  r<  r  r?  r   )r  index	index_setind_defvarnamess        rV   r  r    sd    zzYND%0G'277#

m(C5w}}558i'(A--rX   c                       e Zd Zd Zy)r  c                 F   t        j                         | _        || j                  _        || j                  _        || j                  _        || j                  _        d | j                  _        d | j                  _        d | j                  _	        i | j                  _
        y rZ   )r   	StateDictr  r  r  r   rw  rx  r|  ry  r  )rS   r  r  r   r  s        rV   __init__zTestPipeline.__init__  sq    '')
(

(



$

!

!%

#

 

rX   N)rw   rN   rx   r  r|   rX   rV   r  r    s    	!rX   r  c                       e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zed        Zed        Zed        Zed        Zd Zd Zd Zed        Zed        Zed        Z d Z!y)TestParforBasiczZSmoke tests for the parfors transforms. These tests check the most basic
    functionalityc                     t        j                  | g|  t        j                  t        j                  d      d      }t        j                  d      t        j                  d      ||j
                  g| _        y )N      (@r   r         @      @)r   r  r   r   arangeTsimple_args)rS   r   r-  s      rV   r  zTestParforBasic.__init__  sR      --JJryy~v.IIbM299R=!QSSArX   c                     d }| j                  t              5 }| j                  |       d d d        | j                  dt	        j
                               y # 1 sw Y   /xY w)Nc                  ,    t        j                  d      S )Nr|   r   onesr|   rX   rV   	test_implz0TestParforBasic.test_simple01.<locals>.test_impl  s    772;rX   '@do_scheduling' not foundassertRaisesAssertionErrorr   r   r  	exceptionrS   r  raisess      rV   test_simple01zTestParforBasic.test_simple01  sK    	~.&JJy! /4c&:J:J6KL /.   AA"c                 ,    d }| j                  |       y )Nc                  ,    t        j                  d      S )Nr   r  r|   rX   rV   r  z0TestParforBasic.test_simple02.<locals>.test_impl  s    774= rX   r   rS   r  s     rV   test_simple02zTestParforBasic.test_simple02  s    	!

9rX   c                 ,    d }| j                  |       y )Nc                  ,    t        j                  d      S Nr   r   r  r|   rX   rV   r  z0TestParforBasic.test_simple03.<locals>.test_impl      776?"rX   r  r  s     rV   test_simple03zTestParforBasic.test_simple03      	#

9rX   c                 ,    d }| j                  |       y )Nc                  ,    t        j                  d      S Nr   r  r|   rX   rV   r  z0TestParforBasic.test_simple04.<locals>.test_impl  s    771:rX   r  r  s     rV   test_simple04zTestParforBasic.test_simple04  s    	

9rX   c                 ,    d }| j                  |       y )Nc                  L    t        j                  dt         j                        S )Nr   dtyper   r  
complex128r|   rX   rV   r  z0TestParforBasic.test_simple07.<locals>.test_impl  s    77677rX   r  r  s     rV   test_simple07zTestParforBasic.test_simple07  s    	8

9rX   c                 ,    d }| j                  |       y )Nc                  X    t        j                  d      t        j                  d      z   S r  r  r|   rX   rV   r  z0TestParforBasic.test_simple08.<locals>.test_impl  s    776?RWWV_44rX   r  r  s     rV   test_simple08zTestParforBasic.test_simple08  s    	5

9rX   c                 ,    d }| j                  |       y )Nc                  ,    t        j                  d      S )Nr   r   r  r|   rX   rV   r  z0TestParforBasic.test_simple09.<locals>.test_impl  r  rX   r  r  s     rV   test_simple09zTestParforBasic.test_simple09  r  rX   c                 ,    d }| j                  |       y )Nc                  ,    t        j                  d      S )Nr   r   r  r|   rX   rV   r  z0TestParforBasic.test_simple10.<locals>.test_impl  r  rX   r  r  s     rV   test_simple10zTestParforBasic.test_simple10  r  rX   c                 ,    d }| j                  |       y )Nc                  2    t        j                  d      dz   S Nr   r   rF  r  r|   rX   rV   r  z0TestParforBasic.test_simple11.<locals>.test_impl  s    778$r))rX   r  r  s     rV   test_simple11zTestParforBasic.test_simple11  s    	*

9rX   c                 ,    d }| j                  |       y )Nc                  X    t        j                  d      t        j                  d      z   S r  r  r|   rX   rV   r  z0TestParforBasic.test_simple12.<locals>.test_impl  s    778$r}}R'888rX   r  r  s     rV   test_simple12zTestParforBasic.test_simple12  s    	9

9rX   c                     d }| j                  t              5 }| j                  |       d d d        | j                  dt	        j
                               y # 1 sw Y   /xY w)Nc                  ,    t        j                  d      S r[  )r   r  r|   rX   rV   r  z0TestParforBasic.test_simple13.<locals>.test_impl  s    ==$$rX   r  r  r  s      rV   test_simple13zTestParforBasic.test_simple13  sK    	%~.&JJy! /4c&:J:J6KL /.r  c                 ,    d }| j                  |       y )Nc                  8    t        j                  d      dd d   S )Nr  r      r  r|   rX   rV   r  z0TestParforBasic.test_simple14.<locals>.test_impl  s    778$QUU++rX   r  r  s     rV   test_simple14zTestParforBasic.test_simple14  s    	,

9rX   c                 D    d } | j                   |g| j                    y )Nc                     | | z   S rZ   r|   v1v2m1m2s       rV   r  z0TestParforBasic.test_simple15.<locals>.test_impl      7NrX   r   r  r  s     rV   test_simple15zTestParforBasic.test_simple15       	

90t//0rX   c                 D    d } | j                   |g| j                    y )Nc                     ||z   S rZ   r|   r+  s       rV   r  z0TestParforBasic.test_simple16.<locals>.test_impl  r0  rX   r1  r  s     rV   test_simple16zTestParforBasic.test_simple16  r3  rX   c                 D    d } | j                   |g| j                    y )Nc                     || z   S rZ   r|   r+  s       rV   r  z0TestParforBasic.test_simple17.<locals>.test_impl  r0  rX   r1  r  s     rV   test_simple17zTestParforBasic.test_simple17  r3  rX   c                 D    d } | j                   |g| j                    y )Nc                 `    |j                   t        j                  j                  |      d   z   S r  )r  r   linalgsvdr+  s       rV   r  z0TestParforBasic.test_simple18.<locals>.test_impl  s#    44"))--+A...rX   r1  r  s     rV   test_simple18zTestParforBasic.test_simple18  s     	/

90t//0rX   c                 D    d } | j                   |g| j                    y )Nc                 .    t        j                  ||      S rZ   r   r\  r+  s       rV   r  z0TestParforBasic.test_simple19.<locals>.test_impl      66"b>!rX   r1  r  s     rV   test_simple19zTestParforBasic.test_simple19       	"

90t//0rX   c                     d }| j                  t              5 } | j                  |g| j                    d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                 .    t        j                  ||      S rZ   rA  r+  s       rV   r  z0TestParforBasic.test_simple20.<locals>.test_impl
  rB  rX   r  )r  r  r   r  r   r  r  r  s      rV   test_simple20zTestParforBasic.test_simple20  sZ    	" ~.&DJJy44#3#34 /4c&:J:J6KL /.s   A%%A.c                 D    d } | j                   |g| j                    y )Nc                 .    t        j                  | |       S rZ   rA  r+  s       rV   r  z0TestParforBasic.test_simple21.<locals>.test_impl  rB  rX   r1  r  s     rV   test_simple21zTestParforBasic.test_simple21  rD  rX   c                 D    d } | j                   |g| j                    y )Nc                 2    t        j                  | | z         S rZ   r   rg  r+  s       rV   r  z0TestParforBasic.test_simple22.<locals>.test_impl  s    66"r'?"rX   r1  r  s     rV   test_simple22zTestParforBasic.test_simple22  s     	#

90t//0rX   c                 D    d } | j                   |g| j                    y )Nc                 d    d| z  }d| z  }dt        j                  |dz  |dz  z   dk        z  dz  S )Nr   r   r   r   rM  )r,  r-  r.  r/  r   ys         rV   r  z0TestParforBasic.test_simple23.<locals>.test_impl  s=    BABArvvadQTkAo..33rX   r1  r  s     rV   test_simple23zTestParforBasic.test_simple23  s"    	4 	

90t//0rX   c                 ,    d }| j                  |       y )Nc                      d} t        j                  | | f      }t        j                  |       }t        j                  |d d |f         S )Nr'  )r   r  r  rg  )r   ri  r   s      rV   r  z0TestParforBasic.test_simple24.<locals>.test_impl$  s;    AAA		!A66!AqD'?"rX   r  r  s     rV   test_simple24zTestParforBasic.test_simple24#  s    	#
 	

9rX   c                 D    d } | j                   |g| j                    y)zAsame as corresponding test_simple_<n> case but using operator.addc                 .    t        j                  | |       S rZ   operatorr  r+  s       rV   r  z:TestParforBasic.test_simple_operator_15.<locals>.test_impl.      <<B''rX   Nr1  r  s     rV   test_simple_operator_15z'TestParforBasic.test_simple_operator_15+  s"    	( 	

90t//0rX   c                 D    d } | j                   |g| j                    y )Nc                 .    t        j                  ||      S rZ   rX  r+  s       rV   r  z:TestParforBasic.test_simple_operator_16.<locals>.test_impl5  rZ  rX   r1  r  s     rV   test_simple_operator_16z'TestParforBasic.test_simple_operator_163  "    	( 	

90t//0rX   c                 D    d } | j                   |g| j                    y )Nc                 .    t        j                  ||       S rZ   rX  r+  s       rV   r  z:TestParforBasic.test_simple_operator_17.<locals>.test_impl<  rZ  rX   r1  r  s     rV   test_simple_operator_17z'TestParforBasic.test_simple_operator_17:  r_  rX   c                 d    d }d }t        j                  d      }| j                  |||g       y )Nc                     | dz  } d| d d  y )Nr   r   r|   r   s    rV   r  z5TestParforBasic.test_inplace_alias.<locals>.test_implC  s    FAAaDrX   c                 D    t         j                  j                  | |       y rZ   r   r   assert_equalr   s     rV   comparerz4TestParforBasic.test_inplace_alias.<locals>.comparerG      JJ##Aq)rX   r   r   r   r  r   )rS   r  ri  r   s       rV   test_inplace_aliasz"TestParforBasic.test_inplace_aliasA  s/    		* GGAJ

9aXJ
?rX   N)"rw   rN   rx   rC  r  r  r  r  r  r  r  r  r  r  r!  r$  r(  r2  r6  r9  r<   r>  r;   rC  rG  rJ  rN  rR  rU  r=   r[  r^  rb  rm  r|   rX   rV   r  r    s    BM








M
1
1
1
 1 1
 1 1
 M M 1 1
1
1 1 1 1 1 1 1
@rX   r  c                   2    e Zd ZdZd Zd Zed        Zd Zy)TestParforNumericalMiscz+ Miscellaneous 'classical' numerical tests c                     d }| j                  |dd       | j                  t        |t        j                  f      d       | j                  t        |t        j                  f      d       y )Nc                     dt         j                  j                  |       z  dz
  }dt         j                  j                  |       z  dz
  }dt        j                  |dz  |dz  z   dk        z  | z  S )Nr   r   r   )r   randomranfrg  )r   r   rQ  s      rV   r  z2TestParforNumericalMisc.test_pi.<locals>.test_implS  sc    BIINN1%%)ABIINN1%%)ArvvadQTkAo..22rX   i r   decimalr   )r   r   r   r   int64r  intpr  s     rV   test_pizTestParforNumericalMisc.test_piR  sU    	3
 	

9fa
0i%++A1EY>BrX   c                 r    t         j                  d d  fdz  }| j                  t        t        |      d       y Nr   r   )r   float64r   r   rY  rS   r   s     rV   test_blackscholesz)TestParforNumericalMisc.test_blackscholes\  s0    a #a'&7>BrX   c                    t         j                  d d  t         j                  d d d d f   t         j                  d d  t         j                  f}| j                  t	        t
        |      d       | j                  t        t
        |      d       y Nr   r   )r   r{  rv  r   r   ra  r  r|  s     rV   test_logistic_regressionz0TestParforNumericalMisc.test_logistic_regressiona  se    a %--!"4emmA6Fgt4a8)'48!<rX   c                    t         j                  j                  d       d}d}d}t         j                  j                  ||f      }t         j                  j                  ||f      }| j	                  t
        ||d|d       t        j                  t        j                  dd      t        j                  t        j                  t        j                  t        j                  dd      f}| j                  t        t
        |      d       y )	Nr      r   r   r   rt  r   C)r   rr  seedrs  r   rt  r   Arrayr{  rw  r   r  )rS   rn  ro  centersri  rl  arg_typss          rV   test_kmeansz#TestParforNumericalMisc.test_kmeansh  s    
		qIINNAq6"!5

&7A~LM 	 	O KKq#6

EJJKKq#68'(;XF	KrX   N)	rw   rN   rx   rC  rx  r}  r;   r  r  r|   rX   rV   ro  ro  N  s+    5CC
 = =KrX   ro  c                       e Zd ZdZed        Zd Zd Zd Zd Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zy)TestParforNumPyz'Tests NumPy functionality under parforsc                     d }t        j                  ddd      j                  dd      }t        j                  ddd      }| j                  |||       y )Nc                 .    t        j                  | |      S rZ   rA  r   r  s     rV   r  z-TestParforNumPy.test_mvdot.<locals>.test_impl      66!Q<rX   r   r   r'  r   r   )r   r   r   r   )rS   r  ri  r  s       rV   
test_mvdotzTestParforNumPy.test_mvdot}  sJ    	  KK1b!))!R0KK1b!

9a#rX   c                 f   t         j                  t         j                  t         j                  t         j                  fD ]o  fd}| j                  |d       | j                  t        |t        j                  f      d       | j                  t        |t        j                  f      d       q y )Nc                 h    t        j                  |       } |      }|j                         }||z   S rZ   r   r  rg  )r   ri  r  Br<  s       rV   r  zBTestParforNumPy.test_fuse_argmin_argmax_max_min.<locals>.test_impl  s-    GGAJqEEEG1urX      r   r   )r   rh  argmaxminmaxr   r   r   r   rv  r  rw  )rS   r  r<  s     @rV   test_fuse_argmin_argmax_max_minz/TestParforNumPy.test_fuse_argmin_argmax_max_min  su    99bii8B
 JJy#&\)ekk_EqI[UZZMBAF 9rX   c                 `    d }| j                  t        |t        j                  f      d       y )Nc                 "    t        |       }|d   S r  r   r   ri  s     rV   r  zDTestParforNumPy.test_np_random_func_direct_import.<locals>.test_impl  s    aAQ4KrX   r   r   r   r   rv  r  s     rV   !test_np_random_func_direct_importz1TestParforNumPy.test_np_random_func_direct_import  s&    	 	i%++A1ErX   c                     d }d }d }dddt        dd      t        dd      fD ];  }| j                  ||       | j                  |d	|       | j                  |d	|d	       = y )
Nc                 ,    t        j                  |       S rZ   r   r  r   s    rV   
test_impl1z/TestParforNumPy.test_arange.<locals>.test_impl1      99Q<rX   c                 .    t        j                  | |      S rZ   r  sr   s     rV   
test_impl2z/TestParforNumPy.test_arange.<locals>.test_impl2  s    99Q?"rX   c                 0    t        j                  | ||      S rZ   r  r  r   ts      rV   
test_impl3z/TestParforNumPy.test_arange.<locals>.test_impl3  s    99Q1%%rX               >@r   r   r   complexr   rS   r  r  r  args        rV   test_arangezTestParforNumPy.test_arange  sd    	 	#	& T71Q<1>CJJz3'JJz1c*JJz1c1- ?rX   c                     d }d }d }dD ];  }| j                  ||       | j                  |d|       | j                  |d|d       = y )Nc                 L    t        j                  | t         j                        S Nr
  r   r  float32r   s    rV   r  z5TestParforNumPy.test_arange_dtype.<locals>.test_impl1  s    99Qbjj11rX   c                 N    t        j                  | |t         j                        S r  r  r  s     rV   r  z5TestParforNumPy.test_arange_dtype.<locals>.test_impl2  s    99Q44rX   c                 P    t        j                  | ||t         j                        S r  r  r  s      rV   r  z5TestParforNumPy.test_arange_dtype.<locals>.test_impl3  s    99Q1BJJ77rX   )r  r  r  r   r  r  s        rV   test_arange_dtypez!TestParforNumPy.test_arange_dtype  sM    	2	5	8 #CJJz3'JJz1c*JJz1c1- #rX   c                     d }d }dddt        dd      t        dd      fD ])  }| j                  |d|       | j                  |d|d	       + y )
Nc                 .    t        j                  | |      S rZ   r   )startstops     rV   r  z1TestParforNumPy.test_linspace.<locals>.test_impl1  s    ;;ud++rX   c                 0    t        j                  | ||      S rZ   r   )r  r  nums      rV   r  z1TestParforNumPy.test_linspace.<locals>.test_impl2  s    ;;udC00rX   r  r  r  r   r   r      r  )rS   r  r  r  s       rV   test_linspacezTestParforNumPy.test_linspace  sQ    	,	1 T71Q<1>CJJz1c*JJz1c2. ?rX   c           
      .    d }d}t         j                  j                  |      }t         j                  j                  d|df      } j	                  ||        j	                  ||        j                  t        |t        j                  t        j                  dd      f      d        j                  t        |t        j                  t        j                  dd      f      d        fd	} j                  ||        j                  ||       y )
Nc                 "    | j                         S rZ   meanri  s    rV   r  z,TestParforNumPy.test_mean.<locals>.test_impl  s    668OrX   d   r   r   sizer   r  r   c                  &     j                  d      S r  r  r\   s   rV   <lambda>z+TestParforNumPy.test_mean.<locals>.<lambda>      455a8rX   r   rr  rs  randintr   r   r   r   r  r{  r   r   )rS   r  rn  ri  r  data_gens   `     rV   	test_meanzTestParforNumPy.test_mean  s    	IINN1IIb1v.

9a 

9a i%++emmQPS2T1WXZ[\i%++emmQPS2T1WXZ[\ 9Ix0##Ix8rX   c           
      b    d }d}t         j                  j                  |      }t         j                  j                  d|df      }|d|z  z   } j	                  ||        j	                  ||        j	                  ||        j                  t        |t        j                  t        j                  dd      f      d	        j                  t        |t        j                  t        j                  d	d      f      d	        fd
} j                  ||        j                  ||       y )Nc                 "    | j                         S rZ   )varr  s    rV   r  z+TestParforNumPy.test_var.<locals>.test_impl      557NrX   r  r   r   r                ?r   r  r   c                  &     j                  d      S r  r  r\   s   rV   r  z*TestParforNumPy.test_var.<locals>.<lambda>  r  rX   r  )rS   r  rn  ri  r  r  r  s   `      rV   test_varzTestParforNumPy.test_var  s    	IINN1IIb1v.QJ

9a 

9a 

9a i%++emmQPS2T1WXZ[\i%++emmQPS2T1WXZ[\ 9Ix0##Ix8rX   c                     d }d}t         j                  j                  |      }t         j                  j                  d|df      }|d|z  z   } j	                  ||        j	                  ||        j	                  ||       t        j                  t
        j                  dd      f} j                  t        ||      d	        j                  t        ||      d	        fd
} j                  ||        j                  ||       y )Nc                 "    | j                         S rZ   )stdr  s    rV   r  z+TestParforNumPy.test_std.<locals>.test_impl  r  rX   r  r   r   r  r  r   r  r   c                  &     j                  d      S r  r  r\   s   rV   r  z*TestParforNumPy.test_std.<locals>.<lambda>  r  rX   )r   rr  rs  r  r   r   r  r{  r   r   r   r   )rS   r  rn  ri  r  r  argtyr  s   `       rV   test_stdzTestParforNumPy.test_std  s    	IINN1IIb1v.QJ

9a 

9a 

9a U]]As35i7;i7; 9Ix0##Ix8rX   c                 `    d }| j                  t        |t        j                  f      d       y)z
        Test function with only a random call to make sure a random function
        like ranf is actually translated to a parfor.
        c                 H    t         j                  j                  | | f      }|S rZ   )r   rr  rs  r  s     rV   r  z5TestParforNumPy.test_random_parfor.<locals>.test_impl  s    		1v&AHrX   r   Nr  r  s     rV   test_random_parforz"TestParforNumPy.test_random_parfor  s&    
	 	i%++A1ErX   c                 &   d }d}| j                  |t        j                  |      f      }|j                  |      } ||      }t        j
                  j                  ||d       | j                  t        |t        j                  f      d       y )Nc                    t         j                  j                  | | f      }t         j                  j                  | |       }t         j                  j	                  dd| | f      }t         j                  j                  d| | f      }t         j                  j                  dd| | f      }t         j                  j                  ddd| | f      }t        j                  ||z   |z   |z   |z   |z         S Nr          rF  r   r   )highr  r   )	r   rr  standard_normalr   normal	chisquarer  
triangularrg  r   ri  r  r  ro  EFs          rV   r  z/TestParforNumPy.test_randoms.<locals>.test_impl  s    		))1v)6A		1%A		  cAq62A		##C!Q0A		!!!!1a&!9A		$$Q1q!f5A66!A#a%'!)A+&&rX   r  g?)rtolr   )r   r   r   r   r   r   assert_allcloser   r   r   rv  rS   r  r   r   r   	py_outputs         rV   test_randomszTestParforNumPy.test_randoms  sz    	' &&y5<<?2DE**1-aL	


""=)$"Gi%++A1ErX   c                    d }d}| j                  |t        j                  |      f      }|j                  |      } ||      }| j	                  ||       | j	                  t        |t        j                  f      d       y )Nc                    t         j                  j                  | | f      }t         j                  j                  | |       }t         j                  j	                  dd| | f      }t         j                  j                  d| | f      }t         j                  j                  dd| | f      }t         j                  j                  ddd| | f      }yr  )r   rr  r  r   r  r  r  r  r  s          rV   r  z4TestParforNumPy.test_dead_randoms.<locals>.test_impl  s    		))1v)6A		1%A		  cAq62A		##C!Q0A		!!!!1a&!9A		$$Q1q!f5ArX   r  r   )r   r   r   r   r   r   r   rv  r  s         rV   test_dead_randomsz!TestParforNumPy.test_dead_randoms  sq    	 &&y5<<?2DE**1-aL		2i%++A1ErX   c                     d }d }d}t         j                  j                  |      }t         j                  j                  d|      j	                  t         j
                        }t         j                  j                  ||f      }t        j                  t         j                  t         j                  g      } j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||       d}||fD ]  }	 j                  |	t        j                  d d  f      }
 j                  t              5 }|
j                  t        j                  g t         j                               d d d         j                  |t!        j"                                 fd} j%                  ||        j'                  ||        j%                  ||        j'                  ||       y # 1 sw Y   ~xY w)	Nc                 "    | j                         S rZ   r  r  s    rV   r  z,TestParforNumPy.test_min.<locals>.test_impl1'  r  rX   c                 ,    t        j                  |       S rZ   )r   r  r  s    rV   r  z,TestParforNumPy.test_min.<locals>.test_impl2*      66!9rX      r   r  zDzero-size array to reduction operation minimum which has no identityr
  c                  &     j                  d      S r  r  r\   s   rV   r  z*TestParforNumPy.test_min.<locals>.<lambda>E  r  rX   r   rr  rs  r  astypeint32re  infr   r   r   rv  r  r   r   r   r  r  r   r   rS   r  r  r   ri  r  r  ro  r   r   pcfuncer  s   `            rV   test_minzTestParforNumPy.test_min&  s   		 IINN1IIbq)00:IINNAq6"HHbffbff%&

:q!

:q!

:q!

:q!

:q!

:q!

:q!

:q!/,D**4%++a.1BCF"":.!""288Bbhh#?@ /MM#s1;;/0	 - 9J1##J9J1##J9 /.s   5H??I	c                     d }d }d}t         j                  j                  |      }t         j                  j                  d|      j	                  t         j
                        }t         j                  j                  ||f      }t        j                  t         j                   t         j                   g      } j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||       d}||fD ]  }	 j                  |	t        j                  d d  f      }
 j                  t              5 }|
j                  t        j                  g t         j                               d d d         j                  |t!        j"                                 fd} j%                  ||        j'                  ||        j%                  ||        j'                  ||       y # 1 sw Y   ~xY w)	Nc                 "    | j                         S rZ   )r  r  s    rV   r  z,TestParforNumPy.test_max.<locals>.test_impl1L  r  rX   c                 ,    t        j                  |       S rZ   )r   r  r  s    rV   r  z,TestParforNumPy.test_max.<locals>.test_impl2O  r  rX   r  r   r  zDzero-size array to reduction operation maximum which has no identityr
  c                  &     j                  d      S r  r  r\   s   rV   r  z*TestParforNumPy.test_max.<locals>.<lambda>j  r  rX   r  r  s   `            rV   test_maxzTestParforNumPy.test_maxK  s   		 IINN1IIbq)00:IINNAq6"HHrvvgw'(

:q!

:q!

:q!

:q!

:q!

:q!

:q!

:q!/,D**4%++a.1BCF"":.!""288Bbhh#?@ /MM#s1;;/0	 - 9J1##J9J1##J9 /.s   5II
	c                 p    d }d }d}t        j                  g d      }t         j                  j                  d|      j	                  t         j
                        }t         j                  j                  ||f      }t        j                  ddt         j                  d	d
g      } j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||       d}||fD ]  }	 j                  |	t        j                  d d  f      }
 j                  t              5 }|
j                  t        j                  g t         j                               d d d         j                  |t!        j"                                 fd} j%                  ||        j'                  ||        j%                  ||        j'                  ||       y # 1 sw Y   ~xY w)Nc                 "    | j                         S rZ   )r  r  s    rV   r  z/TestParforNumPy.test_argmax.<locals>.test_impl1q      88:rX   c                 ,    t        j                  |       S rZ   )r   r  r  s    rV   r  z/TestParforNumPy.test_argmax.<locals>.test_impl2t  r  rX   r  )rF  r  r         @r  r   r  rF  r  r  r  z*attempt to get argmax of an empty sequencer
  c                  &     j                  d      S r  r  r\   s   rV   r  z-TestParforNumPy.test_argmax.<locals>.<lambda>  r  rX   r   re  rr  r  r  r   rs  nanr   r   r   rv  r  r   r   r   r  r  r   r   r  s   `            rV   test_argmaxzTestParforNumPy.test_argmaxp     		  HH)*IIbq)00:IINNAq6"HHb"bffb"-.

:q!

:q!

:q!

:q!

:q!

:q!

:q!

:q! ;,D**4%++a.1BCF"":.!""288Bbhh#?@ /MM#s1;;/0	 - 9J1##J9J1##J9 /.   :5H,,H5	c                 p    d }d }d}t        j                  g d      }t         j                  j                  d|      j	                  t         j
                        }t         j                  j                  ||f      }t        j                  ddt         j                  dd	g      } j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||        j                  ||       d
}||fD ]  }	 j                  |	t        j                  d d  f      }
 j                  t              5 }|
j                  t        j                  g t         j                               d d d         j                  |t!        j"                                 fd} j%                  ||        j'                  ||        j%                  ||        j'                  ||       y # 1 sw Y   ~xY w)Nc                 "    | j                         S rZ   )rh  r  s    rV   r  z/TestParforNumPy.test_argmin.<locals>.test_impl1  r  rX   c                 ,    t        j                  |       S rZ   )r   rh  r  s    rV   r  z/TestParforNumPy.test_argmin.<locals>.test_impl2  r  rX   r  )rF  r  r  r  r  r   r  rF  r  r  z*attempt to get argmin of an empty sequencer
  c                  &     j                  d      S r  r  r\   s   rV   r  z-TestParforNumPy.test_argmin.<locals>.<lambda>  r  rX   r  r  s   `            rV   test_argminzTestParforNumPy.test_argmin  r  r  c                     d }t        j                  d      }| j                  ||       t        j                  t        j
                  dd      f}| j                  t        ||      d       y )Nc                 (    | j                  d       | S N      @fillr   s    rV   r  z4TestParforNumPy.test_ndarray_fill.<locals>.test_impl      FF3KHrX   r   r   r  r   zerosr   r   r  r{  r   r   rS   r  r   r  s       rV   test_ndarray_fillz!TestParforNumPy.test_ndarray_fill  sT    	 HHRL

9a U]]As35i7;rX   c                     d }t        j                  d      }| j                  ||       t        j                  t        j
                  dd      f}| j                  t        ||      d       y )Nc                 (    | j                  d       | S r  r  r!  s    rV   r  z6TestParforNumPy.test_ndarray_fill2d.<locals>.test_impl  r"  rX   r   r   r   r  r   r#  r%  s       rV   test_ndarray_fill2dz#TestParforNumPy.test_ndarray_fill2d  sT    	 HHUO

9a U]]As35i7;rX   c                 b    d }t        j                  g d      }d}| j                  |||       y )Nc                     t        j                  ||dft         j                        }| d| }|j                  } | dz  }|j	                  dd      }||z  }||d d d d df<   |S Nr   r
  r   rI   r   r$  r{  r  r   r   r   result_matrixsub_azresult_datas         rV   r  z<TestParforNumPy.test_reshape_with_neg_one.<locals>.test_impl  sh    HHaAYbjjAMaFE

AAAb!$A!)K#.M!Aa%   rX   rF  r  r  r        @      @r  g       @g      "@      $@g      &@r  r   r   re  r   rS   r  r   r   s       rV   test_reshape_with_neg_onez)TestParforNumPy.test_reshape_with_neg_one  1    	! HH 4 5

9a#rX   c                 b    d }t        j                  g d      }d}| j                  |||       y )Nc                     t        j                  ||dft         j                        }| d| }|j                  } | dz  }|j	                  dd      }||z  }||d d d d df<   |S )Nr   r
  r   ir.  r/  s         rV   r  z>TestParforNumPy.test_reshape_with_large_neg.<locals>.test_impl  sh    HHaAYbjjAMaFE

AAAeQ'A!)K#.M!Aa%   rX   r4  r   r8  r9  s       rV   test_reshape_with_large_negz+TestParforNumPy.test_reshape_with_large_neg  r;  rX   c                 "   | j                  t        j                        5 }t        d      d        }t	        j
                  g d      }d} |||       d d d        d}| j                  |t        j                               y # 1 sw Y   1xY w)NTr   c                     t        j                  ||dft         j                        }| d| }|j                  } | dz  }|j	                  dd      }||z  }||d d d d df<   |S r-  r.  )r   r   rmr1  r2  r3  s         rV   r  zETestParforNumPy.test_reshape_with_too_many_neg_one.<locals>.test_impl  sf    XXq!Qirzz:!AJJEMM"b)#ai'1Qq5		rX   r4  r   z7The reshape API may only include one negative argument.)	r  r   UnsupportedRewriteErrorr   r   re  r   r  r  )rS   raisedr  r   r   r   s         rV   "test_reshape_with_too_many_neg_onez2TestParforNumPy.test_reshape_with_too_many_neg_one  s    v==>&4  !  8 9AAaO ?" Ic3v//01% ?>s   5BBc                 X    d }| j                  |t        j                  d      d       y )Nc                     t        j                  |       t        j                  |       z   t        j                  |       z   t        j                  |       z   t        j
                  |       z   S rZ   )r   rg  prodr  r  r  r   s    rV   r  z0TestParforNumPy.test_0d_array.<locals>.test_impl  sD    66!9rwwqz)BFF1I5q	ABFF1IMMrX      Fr   )r   r   re  r  s     rV   test_0d_arrayzTestParforNumPy.test_0d_array  s"    	N

9bhhqkE
BrX   c           	          d }t        j                  d      dz  }| j                  ||       | j                  t	        |t
        j                  d d d   f      d       y )Nc                 f    t        j                  | j                  dz  | j                  dz  z         S rc  )r   rg  realimag)r2  s    rV   r  z6TestParforNumPy.test_real_imag_attr.<locals>.test_impl  s&    66!&&A+!344rX   r   y      ?      ?r   )r   r  r   r   r   r   r  )rS   r  r2  s      rV   test_real_imag_attrz#TestParforNumPy.test_real_imag_attr	  sR    	5 IIaLF#

9a i%2B2B3Q32G1IJANrX   N)rw   rN   rx   rC  r;   r  r  r  r  r  r  r  r  r  r  r  r  r  r
  r  r  r&  r*  r:  r>  rD  rJ  rO  r|   rX   rV   r  r  y  s    1$ $	GF. . 
/9 9$9&FF$F"#:J#:J":H":H<<$$$$2,C
OrX   r  c                   N    e Zd ZdZ ej
                  e d      ed               Zy)TestParforsUnsupportedz$Tests for unsupported use of parforszOnly impacts 32 bit hardwarec                 l   | j                  t        j                        5 }t        d      d        }t	        j
                  ddd      j                  dd      }t	        j
                  ddd      } |||       d	d	d	       d
}| j                  |t        j                               y	# 1 sw Y   1xY w)zu
        This test is in place until issues with the 'parallel'
        target on 32 bit hardware are fixed.
        Tr   c                 .    t        j                  | |      S rZ   rA  r  s     rV   ddotzHTestParforsUnsupported.test_unsupported_combination_raises.<locals>.ddot  s    vva|#rX   r   r   r'  r   r   NzCThe 'parallel' target is not currently supported on 32 bit hardware)
r  r   UnsupportedParforsErrorr   r   r   r   r   r  r  )rS   rC  rT  ri  r  r   s         rV   #test_unsupported_combination_raisesz:TestParforsUnsupported.test_unsupported_combination_raises  s     v==>&4 $ !$ Aq"%--a4AAq"%AAJ ?c3v//01 ?>s   AB**B3N)	rw   rN   rx   rC  unittestskipIfr:   r;   rV  r|   rX   rV   rQ  rQ    s0    .X__Z!?@2  A2rX   rQ  c                   
   e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Zed        Zd Zd Zed        Zed        Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d  Z$d! Z%d" Z&d# Z'd$ Z(d% Z)d& Z*d' Z+d( Z,d) Z-d* Z.d+ Z/d, Z0d- Z1d. Z2d/ Z3d0 Z4d1 Z5d2 Z6d3 Z7d4 Z8d5 Z9d6 Z:d7 Z;d8 Z<d9 Z=d: Z>d; Z?d< Z@d= ZAd> ZBd? ZCd@ ZDdA ZEdB ZFdC ZGdD ZHdE ZIdF ZJdG ZKdH ZLdI ZMdJ ZNdK ZOdL ZPeQeRdM               ZSyN)OTestParforsz6 Tests cpython, reduction and various parfors featuresc                 6     d } j                  | fd       y )Nc                     | |z  |z   S rZ   r|   )r   r   rQ  s      rV   r  z,TestParfors.test_arraymap.<locals>.test_impl.  s    q519rX   c                  &     j                  d      S Nr   r  r\   s   rV   r  z+TestParfors.test_arraymap.<locals>.<lambda>1  s    t/I/I!/LrX   )r   r  s   ` rV   test_arraymapzTestParfors.test_arraymap-  s    	 	I'LMrX   c                 d    d }| j                  |       | j                  t        |d      d       y )Nc                      t        j                  d      } t        j                  d      }t        j                  | |z         S )Nr   r      )r   re  r  rg  r^  r]  s     rV   r  z0TestParfors.test_0d_broadcast.<locals>.test_impl4  s/    A!A66!a%= rX   r|   r   r   r   r   r  s     rV   test_0d_broadcastzTestParfors.test_0d_broadcast3  ,    	! 	

9i4a8rX   c                 d    d }| j                  |       | j                  t        |d      d       y )Nc                      t        j                  d      } t        j                  d      }t        j                  | |z         S Nrb  )r   r  r$  rg  rd  s     rV   r  z-TestParfors.test_2d_parfor.<locals>.test_impl<  s0    !A"A66!a%= rX   r|   r   re  r  s     rV   test_2d_parforzTestParfors.test_2d_parfor;  rg  rX   c                 h     d  fd}d } j                  ||        j                  ||       y )Nc               3   l   K   t        j                  d      } t        j                  d      }| |f y wrj  r   r  r$  rd  s     rV   case1z)TestParfors.test_nd_parfor.<locals>.case1D  s+     !A"Aa&Ls   24c                  D    t                 j                  d            S rc  )r
   r  )ro  rS   s   rV   r  z,TestParfors.test_nd_parfor.<locals>.<lambda>I  s    5$*D*DQ*GHrX   c                 2    t        j                  | |z         S rZ   rM  rd  s     rV   r  z-TestParfors.test_nd_parfor.<locals>.test_implK  s    66!a%= rX   )r   r   )rS   r  r  ro  s   `  @rV   test_nd_parforzTestParfors.test_nd_parforC  s7    	
 I	! 	Ix0##Ix8rX   c                 D    ddl m fd}d}| j                  ||       y )Nr   )r  c                      |       }|d   S r  r|   )r   ri  r  s     rV   r  z9TestParfors.test_np_func_direct_import.<locals>.test_implS  s    QAQ4KrX   o   )r  r  r   )rS   r  r   r  s      @rV   test_np_func_direct_importz&TestParfors.test_np_func_direct_importQ  s     	 

9a rX   c                    d }| j                  |dd       | j                  t              5 } t        d      |      } |dd       d d d        d}| j	                  |t        j                               y # 1 sw Y   1xY w)Nc                     t        j                  |       }t        j                  |      }t        j                  ||z         S rZ   r  )r-  r   ri  r  s       rV   r  z2TestParfors.test_size_assertion.<locals>.test_implZ  s.    
A
A66!a%= rX   r   Tr   	   zSizes of A, B do not match)r   r  r  r   r   r  r  )rS   r  r  r   r   s        rV   test_size_assertionzTestParfors.test_size_assertionY  sq    	!
 	

9b"%~.&'D$'	2E"aL / +c3v//01	 /.s   A88Bc                     d }d}t         j                  j                  |      }t        j                  |      }| j	                  ||||       y )Nc                     t        j                  d      D ]5  }t        ||z  dz  |dz   |z  dz        D ]  }d||<   | |   dkD  sd||<    7 |S )Nr   r   r   r   r   r   )r   is_positivern  r   rq  s        rV   r  z'TestParfors.test_cfg.<locals>.test_implh  s^    \\!_!Q1a
4A%&KNtax)*A 5 % rX   r  )r   rr  randr$  r   )rS   r  rn  r   r~  s        rV   test_cfgzTestParfors.test_cfgf  s?    	 IINN1hhqk

9aa0rX   c           	         d }d}t         j                  j                  |      }| j                  ||       t         j                  j	                  d|      j                  t         j                        }| j                  ||       d }| j                         5  | j                  |       d d d        d}t         j                  j	                  d|      j                  t         j                        }d }| j                  ||       d }| j                  ||j                  d	             d
 }| j                  ||j                  d	             | j                  t        |t        j                  d d d d f   f      d       d }| j                  ||       | j                  t        |t        j                  d d  f      d       y # 1 sw Y   xY w)Nc                 "    d}t        d | |      S )Nr   c                     t        | |      S rZ   r  r   s     rV   r  z<TestParfors.test_reduce.<locals>.test_impl.<locals>.<lambda>y  s
    c!QirX   r   )ri  init_vals     rV   r  z*TestParfors.test_reduce.<locals>.test_implw  s    H/H==rX   r  r   r  c                  L    d } t        | t        j                  g d      d      S )Nc                     | dz  S rc  r|   r!  s    rV   r  z<TestParfors.test_reduce.<locals>.test_impl.<locals>.<lambda>  s    !q&rX   r   r   r   r   r   r   )r   r   re  )gs    rV   r  z*TestParfors.test_reduce.<locals>.test_impl  s     A!RXXo6::rX      c                 8    t        j                  | | dk\           S r^  rM  r  s    rV   r  z*TestParfors.test_reduce.<locals>.test_impl  s    66!AqD'?"rX   c                 N    | d d df   }t        j                  | |dk\  df         S )Nr   r   r   rM  ri  r  s     rV   r  z*TestParfors.test_reduce.<locals>.test_impl  s*    !A#A66!AqDF)$$rX   )   r   c                 R    | d d df   }t        j                  | |dk\  ddf         S )Nr   r   r   r   rM  r  s     rV   r  z*TestParfors.test_reduce.<locals>.test_impl  s.    !A#A66!AqD1H+&&rX   r   c                 6    t        j                  |       }| |z
  S rZ   )r   amin)ri  min_vals     rV   r  z*TestParfors.test_reduce.<locals>.test_impl  s    ggajGw;rX   )r   rr  rs  r   r  r  r   assertTypingErrorr   r   r   r   r{  rS   r  r   ri  s       rV   test_reducezTestParfors.test_reducev  sn   	> IINN1

9a IIbq)00:

9a 	; ##%JJy! & IIbq)00:	#

9a 	% 	

9aii01	' 	

9aii01i%--!2D1FGK	 	

9a i%--2B1DEqI? &%s   G		Gc                     d }d}| j                  t              5 }| j                  |d      }d d d        | j                  |t	        j
                               y # 1 sw Y   /xY w)Nc                  T    d} t        d      D ]  }t        j                  |       }  | S r  )r   cmathrH  accr   s     rV   r  z9TestParfors.test_use_of_reduction_var1.<locals>.test_impl  s'    CAYjjo JrX   CUse of reduction variable acc in an unsupported reduction function.r|   r  r   r   r   r  r  rS   r  r   r  r  s        rV   test_use_of_reduction_var1z&TestParfors.test_use_of_reduction_var1  sV    	 Uz*a**9b9F +c3q{{+, +*   AA%c                     d }d}| j                  t        j                        5 }| j                  |d      }d d d        | j	                  |t        j                               y # 1 sw Y   /xY w)Nc                  4    d} t        d      D ]  }| dz  } 	 | S Nr  r   r   r  s     rV   r  z9TestParfors.test_unsupported_floordiv1.<locals>.test_impl  s#    CAY	 JrX   zParallel floordiv reductions are not supported. If all divisors are integers then a floordiv reduction can in some cases be parallelized as a multiply reduction followed by a floordiv of the resulting product.r|   )r  r   NumbaValueErrorr   r   r  r  r  s        rV   test_unsupported_floordiv1z&TestParfors.test_unsupported_floordiv1  s]    	(
 v556!**9b9F 7c3q{{+, 76   A&&A/c                     d }d}| j                  t              5 }| j                  |d      }d d d        | j                  |t	        j
                               y # 1 sw Y   /xY w)Nc                  :    d} t        d      D ]
  }| |dz   z  }  | S r  r  r  s     rV   r  z4TestParfors.test_unsupported_xor1.<locals>.test_impl  s'    CAYq1u JrX   r  r|   r  r  s        rV   test_unsupported_xor1z!TestParfors.test_unsupported_xor1  sV    	 Uz*a**9b9F +c3q{{+, +*r  c                     d }d}| j                  ||       | j                  t        |t        j                  f      d       y )Nc                 L    t        j                  |       }|j                         S rZ   r  r  s     rV   r  z8TestParfors.test_parfor_array_access1.<locals>.test_impl  s    
A557NrX   r  r   )r   r   r  r   rw  rS   r  r   s      rV   test_parfor_array_access1z%TestParfors.test_parfor_array_access1  s9    	 

9a Y>BrX   c                     d }d}| j                  ||       | j                  t        |t        j                  f      d       y )Nc                     t        j                  |       }d}d} t        j                  t	        |            D ]
  }|||   z  } t        j                  t	        |            D ]  }|| k(  s	| ||   z  }  || z   S r  )r   r  r   r   r   r   ri  r-  r   s       rV   r  z8TestParfors.test_parfor_array_access2.<locals>.test_impl  su    
AAA\\#a&)QqT	 * \\#a&)61IA * q5LrX   r  r   r   r   r  r   rw  r  s      rV   test_parfor_array_access2z%TestParfors.test_parfor_array_access2  s;    	 

9a 4YNPQRrX   c                     d }d}| j                  t        j                        5 }| j                  ||       d d d        | j	                  dt        j                               y # 1 sw Y   /xY w)Nc                     t        j                  | t         j                        }d}t        j                  t        |            D ]  }|||   z  }|dk(  s|} y Nr   r   )r   r  rv  r   r   r   r  s       rV   r  z8TestParfors.test_parfor_array_access3.<locals>.test_impl  sK    288$AA\\#a&)QqT	a4A *rX   r  z Overwrite of parallel loop index)r  r   rB  r   r   r  r  )rS   r  r   r  s       rV   test_parfor_array_access3z%TestParfors.test_parfor_array_access3  sZ    	 v==>&JJy!$ ?8#f>N>N:OP ?>r  c           	      D   d }d}d}t         j                  j                  ||f      }t         j                  j                  |      }| j                  |||       t	        |t        j                  t
        j                  dd      t        j                  t
        j                  dd      f      \  }}| j                  t        |j                        dk(  xr d|j                  v        |j                  d   }d}	d }
|j                  D ]5  }t        |t        j                  j                  j                         s2d	}	|}
7 | j                  |	       d}|
j"                  j%                         D ]  }|j                  D ]  }t        |t&        j(                        st        |j*                  t&        j,                        sC|j*                  j.                  d
k(  s]d	}| j                  |
j0                  |j*                  j2                  v          | j                  |       y )Nc                 .    t        j                  | |      S rZ   rA  )ri  r   s     rV   r  z8TestParfors.test_parfor_array_access4.<locals>.test_impl  r  rX   r  r   r   r  r   r   FTr  )r   rr  rs  r   r  r   r  r{  r7  r   r  r  r   r   r  r  r  r  r  r   r  r  r  r<  r  r?  )rS   r  r   dri  r   r  r  r  parfor_foundr  r  build_tuple_foundbls                 rV   test_parfor_array_access4z%TestParfors.test_parfor_array_access4  s   	  IINNAq6"IINN1

9a#,EMM1c:EMM1c:<= 	GNN+q0HQ'..5HIq!JJD$ 4 4 ; ;<# 
 	%!""))+BtRYY/&tzz277; JJMM]:(,%OOF$4$4

8H8H$HI   , 	)*rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     t        j                  t        |             D ]   }| j                  j	                  d      | |<   " | d   S Nr   r   )r   r   r   r  r   )r   r   s     rV   r  z5TestParfors.test_parfor_dtype_type.<locals>.test_impl&  s7    \\#a&)ww||A! *Q4KrX   r   rl  )rS   r  r   s      rV   test_parfor_dtype_typez"TestParfors.test_parfor_dtype_type$  s$    	
 GGBK

9a rX   c                     d }d}| j                  ||       | j                  t        |t        j                  f      d       y )Nc                     t        j                  | df      }d}t        j                  |       D ]  }|||d d f   j	                         z  } |S )Nr   r   )r   r  r   r   rg  )r   r^  rQ  r   s       rV   r  z8TestParfors.test_parfor_array_access5.<locals>.test_impl0  sG    AAA\\!_QqsVZZ\! %HrX   r  r   r  r  s      rV   test_parfor_array_access5z%TestParfors.test_parfor_array_access5.  s;    	 

9a 4YNPQRrX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                 B    t        d      D ]  }d| d   z  | d<    | d   S )Nr   r   r   r  )outr   s     rV   r  z8TestParfors.test_parfor_hoist_setitem.<locals>.test_impl>  s*    BZSVA  q6MrX   r   rl  )rS   r  r  s      rV   test_parfor_hoist_setitemz%TestParfors.test_parfor_hoist_setitem;  s$    	
 ggaj

9c"rX   c                     d }d}d}| j                  |||       | j                  t        |t        j                  t        j                  f      d       | j                  t        |t        j                  t        j                  f      d       y )Nc                     t        j                  |      }t        j                  | |f      }t        j                  |       }t        d      D ]  }| t        j                  ||      z  } S r^  )r   r  r   r\  )rn  ro  r_  r^  r]  r   r  s          rV   r  z8TestParfors.test_parfor_generate_fuse.<locals>.test_implI  sX    
AAA
A1XR"&&A,&  HrX   r  r   r   )r   r   r  r   rw  r   )rS   r  r   r  s       rV   test_parfor_generate_fusez%TestParfors.test_parfor_generate_fuseF  sm    	 

9a#))ejj%**5MNPQRi%**ejj1IJANrX   c                     d }t        j                  dt         j                        }t        j                  dt         j                        }d|d<   | j                  |||       y )Nc                 .    t        j                  | |      S rZ   )r   bitwise_andr  s     rV   r  z.TestParfors.test_ufunc_expr.<locals>.test_implZ  s    >>!Q''rX   r   r   r   )r   r  uint8r   )rS   r  ri  r  s       rV   test_ufunc_exprzTestParfors.test_ufunc_exprX  sJ    	( GGArxx GGArxx !

9a#rX   c                 `    d }| j                  t        |t        j                  f      d       y )Nc                 N    t        | f      }t        |       D ]
  }|dz   ||<    |S )Nr  )unsafe_emptyr   r   ri  r   s      rV   r  z;TestParfors.test_find_callname_intrinsic.<locals>.test_implc  s.    aT"A1X3w! HrX   r   )r   r  r   rw  r  s     rV   test_find_callname_intrinsicz(TestParfors.test_find_callname_intrinsicb  s'    	 	))ejj]CQGrX   c                 .    d }| j                  |d       y )Nc                 ^    d}t        |       D ]  }|dz  }	 t        |       D ]  }|dz  }	 |S r   r  r   r  r   s      rV   r  z7TestParfors.test_reduction_var_reuse.<locals>.test_implo  s>    CAYq  AYq  JrX   r  r  r  s     rV   test_reduction_var_reusez$TestParfors.test_reduction_var_reusem  s    	 	

9b!rX   c                     d }| j                  |t        j                  d      t        j                  d      j                  d             y )Nc                 Z    d}t        | j                  d         D ]  }||   s	|dz  } |S Nr   r   r   rd  )ri  condr  r   s       rV   r  z8TestParfors.test_non_identity_initial.<locals>.test_impl|  s5    AAGGAJ'7FA ( HrX   r   boolr   r   r  r  r  s     rV   test_non_identity_initialz%TestParfors.test_non_identity_initialz  s4    	 	

9bggbk2772;+=+=f+EFrX   c                     d }| j                  |t        j                  d      t        j                  d      j                  d             y )Nc                 x    d}d}t        | j                  d         D ]  }||   r|dz  }|dz  }|dz  } ||z   S )Nr   r   r   r   r  )ri  r  r  r  r   s        rV   r  z9TestParfors.test_if_not_else_reduction.<locals>.test_impl  sP    AAAGGAJ'7FAFAFA ( q5LrX   r   r  r  r  s     rV   test_if_not_else_reductionz&TestParfors.test_if_not_else_reduction  s4    		 	

9bggbk2772;+=+=f+EFrX   c                 .    d }| j                  |d       y )Nc                 ,   d}|d   |d   z  }t        j                  |t         j                        }t        j                  |      j	                  |      }t        j                  |       D ]  }||z  }	 t        j                  |       D ]  }||z  }	 |S N   r   r   r   r   r$  int_r  r   r   r   r   shpr  result1tmpr   s         rV   r  z?TestParfors.test_two_d_array_reduction_reuse.<locals>.test_impl  s    Cq6CF?DhhsBGG,G))D/))#.C\\!_3 % \\!_3 % NrX   r  r  r  s     rV    test_two_d_array_reduction_reusez,TestParfors.test_two_d_array_reduction_reuse  s    	 	

9c"rX   c                 .    d }| j                  |d       y )Nc                     t        j                  dt         j                        }t        j                  |       D ]*  }|t        j
                  |gt         j                        z  }, |S r  )r   r$  r  r   r   re  )r   resultr   s      rV   r  z9TestParfors.test_one_d_array_reduction.<locals>.test_impl  sJ    XXa)F\\!_"((A300 % MrX   r  r  r  s     rV   test_one_d_array_reductionz&TestParfors.test_one_d_array_reduction  s    	 	

9c"rX   c                 .    d }| j                  |d       y )Nc                     d}|d   |d   z  }t        j                  |t         j                        }t        j                  |      j	                  |      }t        j                  |       D ]  }||z  }	 |S r  r  r  s         rV   r  z9TestParfors.test_two_d_array_reduction.<locals>.test_impl  sf    Cq6CF?DhhsBGG,G))D/))#.C\\!_3 % NrX   r  r  r  s     rV   test_two_d_array_reductionz&TestParfors.test_two_d_array_reduction  s    		 	

9c"rX   c                 .    d }| j                  |d       y )Nc                     d}t        j                  |t         j                        }t        j                  g d      j	                  |      }t        j                  |       D ]  }||z  }	 |S )Nr   )rF  r  r  r  r5  r6  )r   r$  r  re  r   r   r   r   r  r  r  r   s        rV   r  zJTestParfors.test_two_d_array_reduction_with_float_sizes.<locals>.test_impl  sW    ChhsBJJ/G((9:BB3GC\\!_3 % NrX   r  r  r  s     rV   +test_two_d_array_reduction_with_float_sizesz7TestParfors.test_two_d_array_reduction_with_float_sizes  s    	 	

9c"rX   c                 .    d }| j                  |d       y )Nc                     d}dt        j                  |t         j                        z  }dt        j                  |      z  }t	        j
                  |       D ]  }||z  }	 |S )Nr  r   )r   r  r  	ones_liker   r   r  s        rV   r  z>TestParfors.test_two_d_array_reduction_prod.<locals>.test_impl  sU    C"''#rww//Gbll7++C\\!_3 % NrX   r  r  r  s     rV   test_two_d_array_reduction_prodz+TestParfors.test_two_d_array_reduction_prod  s    	 	

9c"rX   c                 .    d }| j                  |d       y )Nc                     d}t        j                  |t         j                        }t        j                  |       D ])  }|t        j
                  |t         j                        z  }+ |S )N)r   r   rH  )r   r$  r  r   r   r  )r   r  r  r   s       rV   r  z;TestParfors.test_three_d_array_reduction.<locals>.test_impl  sM    ChhsBGG,G\\!_277300 % NrX   r  r  r  s     rV   test_three_d_array_reductionz(TestParfors.test_three_d_array_reduction  s    	 	

9c"rX   c                 \    d }d}t        j                  |      }| j                  ||       y )Nc                 (    | j                         dz   S r  )argsortr  s    rV   r  z>TestParfors.test_preparfor_canonicalize_kws.<locals>.test_impl  s    99;?"rX   r  r   r  r   r  s       rV   test_preparfor_canonicalize_kwsz+TestParfors.test_preparfor_canonicalize_kws  s)    	# IIaL

9a rX   c                     d }t        j                  dt        j                  d            }| j                  |t	        j
                  |      f      }| j                  |j                  |       ||             y )Nc                     | j                   S rZ   r
  r  s    rV   r  z8TestParfors.test_preparfor_datetime64.<locals>.test_impl  s    77NrX   r   zdatetime64[ns])r   r  r  r   r   r   r   r   )rS   r  ri  r   s       rV   test_preparfor_datetime64z%TestParfors.test_preparfor_datetime64  s_    	 HHQ!123&&y5<<?2DE++A.	!=rX   c                 h    d }| j                  |t        j                  j                  d             y )Nc                     | j                   d   }d}t        |      D ]*  }h d}|j                  |       d}|D ]  }||z  }	 ||z  }, |S )Nr   >   r   r   r   )rd  r   r  )r^  r   r  r   Rr  r   s          rV   r  zITestParfors.test_no_hoisting_with_member_function_call.<locals>.test_impl  sZ    
ACAYaA1HC s
  JrX   r  )r   r   rr  rs  r  s     rV   *test_no_hoisting_with_member_function_callz6TestParfors.test_no_hoisting_with_member_function_call  s$    
	 	

9biinnS12rX   c                 ,    d }| j                  |       y)z issue3671: X != 0 becomes an arrayexpr with operator.ne.
            That is turned into a parfor by devectorizing.  Make sure
            the return type of the devectorized operator.ne
            on integer types works properly.
        c                  V    t        j                  dt         j                        } | dk7  S )Nr   r
  r   )r   r$  r  r^  s    rV   r  z8TestParfors.test_array_compare_scalar.<locals>.test_impl  s    277+A6MrX   Nr  r  s     rV   test_array_compare_scalarz%TestParfors.test_array_compare_scalar  s    	 	

9rX   c                 ^    d }t        j                  d      }| j                  ||dd       y )Nc                 V    t        |       }| d| }|r| d|dz   }|j                         S r  )r   rg  )r   halfr  parrs       rV   r  z?TestParfors.test_array_analysis_optional_def.<locals>.test_impl  s4    q6DQt9D47|88:rX   r'  TFrI  rl  rS   r  r   s      rV    test_array_analysis_optional_defz,TestParfors.test_array_analysis_optional_def  s*    	 GGBK

9a
>rX   c                 d   d }t        j                  dt              }t        j                  dt              }| j                  |||       | j	                  t        |t        j                  t        j                  dd      t        j                  t        j                  dd      f      d       y )Nc                    t        j                  t        |       t         j                        }t        |      }t	        j
                  |      D ]
  }| |   ||<    t	        j
                  |      D ]  }||   ||   z   ||<    |S r  )r   r  r   r{  r   r   )r   r   datar  r   s        rV   r  z7TestParfors.test_prange_side_effects.<locals>.test_impl  sp    88CF"**5Dt9D\\$'A$Q (\\$'q'AaD.Q (KrX   r  r
  r   r  )	r   r  floatr   r   r   r   r  r{  )rS   r  r   rQ  s       rV   test_prange_side_effectsz$TestParfors.test_prange_side_effects  s    	 IIgU+IIgU+

9a#i%*[[3%G%*[[3%G%IJKL	NrX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     d}d}t        j                  t        |             D ]  }| |xx   |d   |d   z   |z   z  cc<    | S )Nr  rH  r   r   )r   r   r   r   atupr   r   s       rV   r  z*TestParfors.test_tuple1.<locals>.test_impl0  sH    DA\\#a&)!Q$q')A-- *HrX   r   r  r  s      rV   test_tuple1zTestParfors.test_tuple1/  $    	 IIbM

9a rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     | j                   }d}t        j                  t        |             D ]  }| |xx   |d   |z   z  cc<    | S )NrH  r   )rd  r   r   r   r  s       rV   r  z*TestParfors.test_tuple2.<locals>.test_impl;  sB    77DA\\#a&)!Q!# *HrX   r   r  r  s      rV   test_tuple2zTestParfors.test_tuple2:  r"  rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     t        j                  d      df}d}t        j                  t	        |             D ]  }| |xx   |d   d   |d   z   |z   z  cc<     | S )Nr   r   rH  r   r   r   )r   r  r   r   r   r  s       rV   r  z*TestParfors.test_tuple3.<locals>.test_implF  sY    IIbM1%DA\\#a&)!Q
T!W,q00 *HrX   r   r  r  s      rV   test_tuple3zTestParfors.test_tuple3E  r"  rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     t        dd      }d}t        j                  t        |             D ])  }| |xx   |j                  |j
                  z   |z   z  cc<   + | S Nr   r   r   rH  )r   r   r   r   r   r   )r   antupr   r   s       rV   r  z/TestParfors.test_namedtuple1.<locals>.test_implQ  sO    "!4EA\\#a&)!ekk1A55 *HrX   r   r  r  s      rV   test_namedtuple1zTestParfors.test_namedtuple1P  r"  rX   c                 v    t        dd      fd}t        j                  d      }| j                  ||       y )NTestNamedTuple2r   c                      dd      }d}t        j                  t        |             D ])  }| |xx   |j                  |j                  z   |z   z  cc<   + | S r+  )r   r   r   r   r   )r   r,  r   r   r/  s       rV   r  z/TestParfors.test_namedtuple2.<locals>.test_impl]  sP    #!15EA\\#a&)!ekk1A55 *HrX   r   )r   r   r  r   )rS   r  r   r/  s      @rV   test_namedtuple2zTestParfors.test_namedtuple2[  s3    $%68JK	 IIbM

9a rX   c                     t        ddg      }d }d } |t        j                  d            }| j                  |||g       y )NTestNamedTuple3rQ  c                 "    d| j                   d d  y )Nr   rQ  re  s    rV   r  z/TestParfors.test_namedtuple3.<locals>.test_impll  s    ACCFrX   c                 l    t         j                  j                  | j                  |j                         y rZ   )r   r   r   rQ  r   s     rV   ri  z.TestParfors.test_namedtuple3.<locals>.comparero  s    JJ**1334rX   r   r5  rk  )r   r   r$  r   )rS   r3  r  ri  r   s        rV   test_namedtuple3zTestParfors.test_namedtuple3g  sD     %>		5 bhhrl+

9aXJ
?rX   c                 X   d }t        j                  d      dz   }t        j                  d      dz   }| j                  |||       | j                  t	        |t        j                  t
        j                  dd      t        j                  t
        j                  dd      f      d       y )Nc                     || z  }|S rZ   r|   r   s     rV   r  z1TestParfors.test_inplace_binop.<locals>.test_implv  s    FAHrX   r   r  r   r  )r   r  r   r   r   r   r  r{  rS   r  r^  r]  s       rV   test_inplace_binopzTestParfors.test_inplace_binopu  s    	 IIbMBIIbMC

9a#i%*[[3%G%*[[3%G%IJKL	NrX   c                 \    d }t        j                  ddg      }| j                  ||       y )Nc                     t        |       }||f}t        j                  d|z   dz   t        j                        }|dd d f   }t	        |       D ]  \  }}||||f<    |S )Nr  r
  r   r   r   r$  uint64r  r   r   array_shapeindicesk_listr   r  s          rV   r  z0TestParfors.test_tuple_concat.<locals>.test_impl  sc    AAQ$Khh{ 2T 9"))LGQT]F!!1 q!t %MrX   r   r8  r  s      rV   test_tuple_concatzTestParfors.test_tuple_concat  s)    	 HHaV

9a rX   c                 \    d }t        j                  ddg      }| j                  ||       y )Nc                     t        |       }||f}t        j                  d|z   dz   d d t        j                        }|dd d f   }t	        |       D ]  \  }}||||f<    |S )Nr  rI   r
  r   r>  r@  s          rV   r  zCTestParfors.test_tuple_concat_with_reverse_slice.<locals>.test_impl  sm    AAQ$Khh{ 2T 93B?%'YY0GQT]F!!1 q!t %MrX   r   r8  r  s      rV   $test_tuple_concat_with_reverse_slicez0TestParfors.test_tuple_concat_with_reverse_slice  s)    		 HHaV

9a rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                 8    | f| | fz   }|d   j                         S r  rg  )r   Ss     rV   r  z6TestParfors.test_array_tuple_concat.<locals>.test_impl  s!    1vAQ488:rX   r   r   rl  r  s      rV   test_array_tuple_concatz#TestParfors.test_array_tuple_concat  s$    	 GGEN

9a rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     | dz  S )Nr5  r|   r!  s    rV   r  z3TestParfors.test_high_dimension1.<locals>.test_impl  s    s7NrX   )r   r   r   r   r      rl  r  s      rV   test_high_dimension1z TestParfors.test_high_dimension1  s$    	GG'(

9a rX   c                 Z    d }d}| j                  |t        j                  |      |       y )Nc                 D    t        j                  |      D ]  }d| |<   	 | S r  r   pndindexr   szr   s      rV   r  z-TestParfors.test_tuple_arg.<locals>.test_impl  #    ^^B'! (HrX   r   r   )r   r   r  rS   r  rW  s      rV   test_tuple_argzTestParfors.test_tuple_arg  s&    	 

9bhhrlB/rX   c                 Z    d }d}| j                  |t        j                  |      d       y )Nc                 D    t        j                  |      D ]  }d| |<   	 | S r  rT  rV  s      rV   r  z=TestParfors.test_tuple_arg_not_whole_array.<locals>.test_impl  rX  rX   rY  r   r   r   r   r$  rZ  s      rV   test_tuple_arg_not_whole_arrayz*TestParfors.test_tuple_arg_not_whole_array  s&    	 

9bhhrlG4rX   c                 X    d }d}| j                  |t        j                  |             y )Nc                 H    d}t        j                  |      D ]  }d| |<   	 | S )NrY  r   rT  rV  s      rV   r  z6TestParfors.test_tuple_for_pndindex.<locals>.test_impl  s(    B^^B'! (HrX   rY  r_  rZ  s      rV   test_tuple_for_pndindexz#TestParfors.test_tuple_for_pndindex  s$    	
 

9bhhrl+rX   c                 Z    d }d}| j                  |t        j                  |      d       y )Nc                 L    |df}t        j                  |      D ]  }d| |<   	 | S rz  rT  )r   firstrW  r   s       rV   r  z5TestParfors.test_tuple_arg_literal.<locals>.test_impl  s,    B^^B'! (HrX   rY  r   r_  rZ  s      rV   test_tuple_arg_literalz"TestParfors.test_tuple_arg_literal  s&    	
 

9bhhrlB/rX   c                      d d d                 fd}t         t        d      fD ]
  } ||        y )Nc                 D    t        j                  |      D ]  }d| |<   	 | S r  rT  rV  s      rV   r  z?TestParfors.test_tuple_of_literal_nonliteral.<locals>.test_impl  rX  rX   c                      || d      S )Nr^  r|   )r   r  s     rV   r6  z:TestParfors.test_tuple_of_literal_nonliteral.<locals>.call  s    a>!rX   c                  ,    t        j                  d      S )Nr  r   r$  r|   rX   rV   r  z>TestParfors.test_tuple_of_literal_nonliteral.<locals>.<lambda>  s    BHHX.rX   c                 l     |       }t              } |        |      }j                  |       y rZ   )r   assertPreciseEqual)	decf1f2gotr6  expected	get_inputrS   r  s	       rV   r   z;TestParfors.test_tuple_of_literal_nonliteral.<locals>.check  s3    YBdBY["%C##Hc2rX   Tr   r   )rS   r   r  r6  rs  rt  r  s   `  @@@@rV    test_tuple_of_literal_nonliteralz,TestParfors.test_tuple_of_literal_nonliteral  sI    	
	" /		Y/	3 	3 d+,A!H -rX   c                 Z    d }d}| j                  |t        j                  |      |       y )Nc                 D    t        j                  |      D ]  }d| |<   	 | S r  rT  rV  s      rV   r  z0TestParfors.test_tuple_arg_1d.<locals>.test_impl  rX  rX   r   r_  rZ  s      rV   test_tuple_arg_1dzTestParfors.test_tuple_arg_1d  s&    	 

9bhhrlB/rX   c                 X    d }d}| j                  |t        j                  |             y )Nc                 H    d}t        j                  |      D ]  }d| |<   	 | S Nry  r   rT  rV  s      rV   r  z8TestParfors.test_tuple_arg_1d_literal.<locals>.test_impl  s(    B^^B'! (HrX   ry  r_  rZ  s      rV   test_tuple_arg_1d_literalz%TestParfors.test_tuple_arg_1d_literal  s$    	
 

9bhhrl+rX   c                 V    d }| j                  |t        j                  d      d       y )Nc                 D    t        j                  |      D ]  }d| |<   	 | S r  rT  rV  s      rV   r  z4TestParfors.test_int_arg_pndindex.<locals>.test_impl  rX  rX   r  r   r_  r  s     rV   test_int_arg_pndindexz!TestParfors.test_int_arg_pndindex  s"    	 	

9bhhx0!4rX   c                    t         d        fd}d}t        j                  ||f      }t        j                  d d d d df   t
        j                  f}| j                  t        ||      d       | j                  |||       y )Nc                 j    t        ||z   dz   dz  dz   |dz
  d      D ]  }| |dz   |f   dz   | ||f<    y Nr   r   r   )ur   evenr  rq  s        rV   issue7854_procz=TestParfors.test_prange_unknown_call1.<locals>.issue7854_proc  sI    D1HqLA-14!8Q?AE1H+/!Q$ @rX   c                     t        j                  d|dz
        D ]  } | |d|        t        j                  d|dz
        D ]  } | |d|        | S r  r   r   )r  r  r   r  s      rV   r  z8TestParfors.test_prange_unknown_call1.<locals>.test_impl
  sV    \\!TAX.q!Q- /\\!TAX.q!Q- /HrX   r   r   r   )
rA   r   r$  r   r{  r   rv  r   r   r   )rS   r  r  r  cptypesr  s        @rV   test_prange_unknown_call1z%TestParfors.test_prange_unknown_call1  sy    		* 
	*	 HHdD\"==CaC(%++6i91=

9a&rX   c                     d }d}t        j                  ||f      }t        j                  d d d d df   t        j
                  f}| j                  t        ||      d       | j                  |||       y )Nc                 8   t        j                  d|dz
        D ]2  }t        |dz   dz  dz   |dz
  d      D ]  }| |dz   |f   dz   | ||f<    4 t        j                  d|dz
        D ]/  }t        |dz  dz   |dz
  d      D ]  }| |dz   |f   dz   | ||f<    1 | S r  r}  )r  r  r   rq  s       rV   r  z6TestParfors.test_prange_index_calc1.<locals>.test_impl  s    \\!TAX.A{Qq!<AAqkAoAadG = / \\!TAX.q1uqy$(A6AAqkAoAadG 7 / HrX   r   r   r   	r   r$  r   r{  r   rv  r   r   r   )rS   r  r  r  r  s        rV   test_prange_index_calc1z#TestParfors.test_prange_index_calc1  sf    	 HHdD\"==CaC(%++6i91=

9a&rX   c                 P   d }d}t        j                  ||f      }t        j                  ||f      }t        j                  d d d d df   t        j                  d d d d df   t        j
                  f}| j                  t        ||      d       | j                  ||||       y )Nc                     t        j                  |      D ]!  }t        |      D ]  }|||f   dz   | ||f<    # t        j                  |      D ]  }t        |      D ]	  }d|||f<     | d   |d   z   S )Nr   r   r  r}  )r   r   r  r   rq  s        rV   r  z9TestParfors.test_prange_reverse_order1.<locals>.test_impl,  s    \\$'tA1gkAadG % ( \\$'tAAadG % ( T7QtW$$rX   r   r   r   r  rS   r  r  r   r   r  s         rV   test_prange_reverse_order1z&TestParfors.test_prange_reverse_order1)  s    	% HHdD\"HHdD\"==CaC(%--3Q3*?Mi91=

9aD)rX   c                     d }d}t        j                  |      }t        j                  d d  t        j
                  f}| j                  t        ||      d       | j                  |||       y )Nc                     d}t        j                  |      D ]  }|| |<   	 t        j                  |      D ]
  }|| d   z  } |S )Nr   r   r  )r   r  r   r   s       rV   r  z@TestParfors.test_prange_parfor_index_then_not.<locals>.test_impl?  sH    A\\$'! (\\$'QqT	 (HrX   r   r   r  )rS   r  r  r   r  s        rV   !test_prange_parfor_index_then_notz-TestParfors.test_prange_parfor_index_then_not<  sY    	 HHTN==#U[[1i91=

9a&rX   c                 N   d }d}t        j                  |      }t        |      }t        j                  d d  t
        j                  j                  t
        j                  |      t
        j                  f}| j                  t        ||      d       | j                  ||||       y )Nc                     d}t        j                  |      D ]  }|||   z   | |<    t        j                  |      D ]  }|| |   |d   z   z  } |S r  r  )r   tupr  r  r   s        rV   r  zJTestParfors.test_prange_parfor_index_const_tuple_fusion.<locals>.test_implP  sY    C\\$'3q6z! (\\$'qtc!f}$ (JrX   r   r   )r   r$  r   r   r{  r   
containersUniTuplerw  r   r   r   r  s         rV   +test_prange_parfor_index_const_tuple_fusionz7TestParfors.test_prange_parfor_index_const_tuple_fusionM  s    	 HHTN!H==###,,U]]DA:: 	i91=

9aD)rX   c                 ,   d }d}t        j                  |      }t        j                  |      }t        j                  d d  t        j                  d d  t        j
                  f}| j                  t        ||      d       | j                  ||||       y )Nc                     t        j                  |      D ]
  }| d   ||<    t        j                  |      D ]  }|| |<   	 |dxx   | d   z  cc<   |S )Nr   r   r  )r   r   r  r   s       rV   r  zITestParfors.test_prange_non_parfor_index_then_opposite.<locals>.test_impld  sV    \\$'t! (\\$'! ( aDAaDLDHrX   r   r   r  r  s         rV   *test_prange_non_parfor_index_then_oppositez6TestParfors.test_prange_non_parfor_index_then_oppositea  ss    	 HHTNHHTN==#U]]1%5u{{Ci91=

9aD)rX   c                     dd}t        j                  d      }| j                  ||d t         j                  j                  d g       | j                  |j                         d       y )Nc                 4    t        d      D ]
  }|d| |<    y )Nr   r  r  )arrpredr   s      rV   r  z3TestParfors.test_prange_optional.<locals>.test_implu  s    AY# CF rX   r   c                     | |k(  S rZ   r|   r   rQ  s     rV   r  z2TestParfors.test_prange_optional.<locals>.<lambda>}  s    AFrX   rk  r7  rZ   )r   r  r   r   r   r   rg  rS   r  r  s      rV   test_prange_optionalz TestParfors.test_prange_optionalt  sZ    	!
 ggbk

9c4')zz'E'E':'< 	 	= 	D)rX   c                     d }| j                  t              5 }| j                  |       d d d        | j                  dt	        j
                               y # 1 sw Y   /xY w)Nc                      d} | d   S )Ng333333?g?r   r|   re  s    rV   r  z8TestParfors.test_untraced_value_tuple.<locals>.test_impl  s    AQ4KrX   r  r  r  s      rV   test_untraced_value_tuplez%TestParfors.test_untraced_value_tuple  sM    	 ~.&JJy! /4c&:J:J6KL /.r  c                     d }| j                  t              5 }| j                  |       d d d        | j                  dt	        j
                               y # 1 sw Y   /xY w)Nc                      d} | d   d   S )N)r  r   r|   re  s    rV   r  zBTestParfors.test_recursive_untraced_value_tuple.<locals>.test_impl  s    AQ47NrX   r  r  r  s      rV   #test_recursive_untraced_value_tuplez/TestParfors.test_recursive_untraced_value_tuple  sM    	 ~.&JJy! /4c&:J:J6KL /.r  c                     d }t        j                  t         j                  dd      f}| j                  t	        ||      d       t        j                  dt
        j                        }| j                  ||       y )Nc                    d}t        |       }t        j                  |t        j                        }t	        |      D ]  }| |   |d   z  ||<    t        |      }t        j                  |t        j                        }t	        |      D ]  }||   |d   z
  ||<    d}t        |      }	t	        |	      D ]
  }
|||
   z  } ||d   z   S )Nr  r   r   r  r   r   r  r{  r   )r  r   n1arr2r   n2arr3rq  totaln3r   s              rV   r  z9TestParfors.test_untraced_value_parfor.<locals>.test_impl  s    ASB88B

+DBZa&1Q4-Q  TB88B

+DBZq'AaD.Q  ETBBZa   1Q4<rX   r   r  r   r
  )r   r  rv  r   r   r   r  r   )rS   r  r  r  s       rV   test_untraced_value_parforz&TestParfors.test_untraced_value_parfor  s[    	   {{5;;3/2i5q9ii"((+

9c"rX   c                 T    d }| j                  |t        j                  d             y )Nc                 h    d}t        | j                  d         D ]  }|r| d| |d d f<   |dz  } | S r  )r   rd  )r   r;  r   s      rV   r  z;TestParfors.test_setitem_2d_one_replaced.<locals>.test_impl  sA    E1771:&%(
 ' HrX   )r   r   r_  r  s     rV   test_setitem_2d_one_replacedz(TestParfors.test_setitem_2d_one_replaced  s     	 	

9bhhv./rX   c                     d }t        j                  d      }| j                  ||dd       | j                  ||dd       | j                  ||dd       y )Nc                     t        j                  | j                        }|r|j                  t         j                        S |r||   }n||dz
     }|| j                  z  S r  )r   r  r  r  r{  )r  flag1flag2invr  s        rV   r  z7TestParfors.test_1array_control_flow.<locals>.test_impl  sQ    ))CHH%Czz"**--#h#'l>!rX   r  TFr  r  s      rV   test_1array_control_flowz$TestParfors.test_1array_control_flow  sL    	" iin

9c4/

9c4.

9c5%0rX   c                     d }t        j                  d      }| j                  ||dd       | j                  ||dd       y )Nc                     t        j                  | j                        }t        j                  || j                  |z         }|r
||   }||z  S ||dz
     }||z  S r  r   r  r  )r  rp  flaginv1inv2r  s         rV   r  z9TestParfors.test_2array_1_control_flow.<locals>.test_impl  s]    99SXX&D99Q1-D4j : 4!8n:rX   r  r   TFr  r  s      rV   test_2array_1_control_flowz&TestParfors.test_2array_1_control_flow  s:    	 iin

9c2t,

9c2u-rX   c                     d }t        j                  d      }| j                  ||dd       | j                  ||dd       y )Nc                     t        j                  | j                        }t        j                  || j                  |z         }|r||   }||   }||z  S ||dz
     }||dz
     }||z  S r  r  )r  rp  r  r  r  ret1ret2s          rV   r  z9TestParfors.test_2array_2_control_flow.<locals>.test_impl  ss    99SXX&D99Q1-DDzDz $; D1H~D1H~$;rX   r  r   TFr  r  s      rV   test_2array_2_control_flowz&TestParfors.test_2array_2_control_flow  s:    		 iin

9c2t,

9c2u-rX   c                     d }| j                  |d       | j                  t        |t        j                  f      d       y )Nc                 H   t        j                  | t         j                        }t        j                  | t         j                        }t        |       D ]  }t	        |      D ]  }||xx   dz  cc<    ! t        |       D ]  }|dk(  r	||   ||dz
     z
  ||<    |dd  S )Nr
  r   r   )r   r$  rw  r   r   )r   rcr   rq  s        rV   r  z-TestParfors.test_issue8515.<locals>.test_impl  s    "''*A"''*AAYqAaDAID "  AY6taAh!  QR5LrX   rP  r   )r   r   r   r   rv  r  s     rV   test_issue8515zTestParfors.test_issue8515  s4    	 	

9b!i%++A1ErX   c                 0    d }| j                  |dd       y )Nc                 $   d}d}t        j                  ||f      }t        |      D ]f  }t        |      D ]V  }t        j                  |      }|d   }t        j                  |      }	t	        | |      D ]  }
d|	|
<   	 |	d   }||z   |||f<   X h |S )Nr  r   r   r   )r   r  r   r  r   )i1i2rn  rK  r   rQ  r   r  r  p2r   rq  s               rV   r  z-TestParfors.test_issue9029.<locals>.test_impl	  s    AA!AA 1XqAWWQZFq	A!B#B^ !1 ,1AUAacF "  HrX   r   r   r  r  s     rV   test_issue9029zTestParfors.test_issue9029  s    	, 	

9a#rX   c                     d }| j                  |dd       | j                  t        |t        j                  t        j                  f      d       y )Nc                     t        j                  d      }t        j                  |      }t        j                  d      }t	        t        | |            }||z   |z   S Nr  )r   r  rf  ceilintr  )r   r   r^  r]  r  s        rV   r  z:TestParfors.test_fusion_no_side_effects.<locals>.test_impl	  sF    A		!AAC1IAq519rX   g@g333333@r   )r   r   r   r   r{  r  s     rV   test_fusion_no_side_effectsz'TestParfors.test_fusion_no_side_effects	  s>    	 	

9c3'i%--1OPRSTrX   c                 v    t        d      d        }| j                   |d      |j                  d             y )NTr   c                 D    d}t        d       t        |       D ]  }|} |S r  r   r   )r   r  r   s      rV   def_in_loopzCTestParfors.test_issue9256_lower_sroa_conflict.<locals>.def_in_loop%	  s'    AAAY HrX   r   r   r   py_func)rS   r  s     rV   "test_issue9256_lower_sroa_conflictz.TestParfors.test_issue9256_lower_sroa_conflict$	  s:    	t		 
	 	R+*=*=b*ABrX   c                     d } |d      }| j                  |  t        d      |      d             | j                  |  t        d      |      d             y )Nc                 Z    | }t        d       t        |       D ]
  }|s| dz   } |dkD  fS Nr   r   r   r  )r   r  _ir  s       rV   r  zLTestParfors.test_issue9256_lower_sroa_conflict_variant1.<locals>.def_in_loop0	  s8    AAQiAA   a!e8OrX   r   Fr   Tr   r   rS   r  rs  s      rV   +test_issue9256_lower_sroa_conflict_variant1z7TestParfors.test_issue9256_lower_sroa_conflict_variant1/	  s\    	 q>#D#74#7#DQ#GH#C#64#6{#CA#FGrX   c                     d } |d      }| j                  |  t        d      |      d             | j                  |  t        d      |      d             y )Nc                 z    | }t        d       t        |       D ]  }|st        |       D ]  }| dz   }	  |dkD  fS r  )r   r   r   )r   r  r  _jr  s        rV   r  zLTestParfors.test_issue9256_lower_sroa_conflict_variant2.<locals>.def_in_loop=	  sF    AAQi#AhE '   a!e8OrX   r   Fr   Tr  r  s      rV   +test_issue9256_lower_sroa_conflict_variant2z7TestParfors.test_issue9256_lower_sroa_conflict_variant2<	  s\    	 q>#D#74#7#DQ#GH#C#64#6{#CA#FGrX   c                 *   t         j                  ddg}i t        j                  ddd}	 t	        j
                  ||t        j                  d       y # t        j                  $ r+}d|j                   }| j                  |       Y d }~y d }~ww xY w)	Nz-mz"numba.tests.parfor_iss9490_usecase1)PYTHONHASHSEEDNUMBA_NUM_THREADSzutf-8)envstderrencodingzsubprocess failed with output:
)r   )
sys
executableosenvironsubpcheck_outputSTDOUTCalledProcessErroroutputfail)rS   cmdenvsr  r   s        rV   "test_issue9490_non_det_ssa_problemz.TestParfors.test_issue9490_non_det_ssa_problemJ	  s     NN0


jj
 " "%
	ct%)[['.0 && 	4QXXJ?CII#I	s   'A B'!BBN)Trw   rN   rx   rC  r_  rf  rk  rr  rv  rz  r  r  r  r  r  r  r  r  r;   r  r  r  r=   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r	  r  r  r  r  r!  r%  r(  r-  r1  r7  r;  rD  rG  rM  rQ  r[  r`  rc  rg  rv  rz  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r<   r@   r  r|   rX   rV   rZ  rZ  )  s   @N999!21 .J`--"
-	CS(Q $+ $+L!S # # O O"$	H"GG#"	####
#!>3

?N$	!	!	!	!
!@
N!! !!05,000,5'*'$*&'"*(*&
*MM#001".."F($6U	CHH " # rX   rZ  c                       e Zd Zd Zd Zd Zy)TestParforsLeaksc                 `     | j                   |g| \  }} | j                  |||g|i | y rZ   r   r   s         rV   r   zTestParforsLeaks.checkg	  ;    (((7$7v$$$VUFLTLVLrX   c                     d }t        j                  d      j                  t         j                        }| j	                  ||       y )Nc                 "    | j                         S rZ   rJ  )r  s    rV   r  z2TestParforsLeaks.test_reduction.<locals>.test_implm	  s    779rX   r   r   r  r  r{  r   r  s      rV   test_reductionzTestParforsLeaks.test_reductionk	  s3    	 iim""2::.

9c"rX   c                     d }t        j                  d      j                  t         j                        }| j	                  ||       y )Nc                 t    d}d}t        | j                        D ]  }|| |   z  }|d| |   dz   z  z  } ||z  S )Nr  rF  r   )r   r  )r  r   r   r   s       rV   r  z@TestParforsLeaks.test_multiple_reduction_vars.<locals>.test_implu	  sN    AACHH%SVR3q6A:&& & q5LrX   r   r  r  s      rV   test_multiple_reduction_varsz-TestParforsLeaks.test_multiple_reduction_varss	  s3    	 iim""2::.

9c"rX   N)rw   rN   rx   r   r  r  r|   rX   rV   r  r  e	  s    M#
#rX   r  c                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	e
d        Ze
d	        Ze
d
        Zd Zd Zd Zd Zd Ze
d        Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zy)TestParforsSlicec                 T    d }| j                  |t        j                  d             y )Nc                 D    | j                   \  }| d|dz
   | d|dz
   z   }|S Nr   r   r   rd  r   r   r   s      rV   r  z6TestParforsSlice.test_parfor_slice1.<locals>.test_impl	  s0    77DQ!AaC1Qqs8#AHrX   r   r   r   r  r  s     rV   test_parfor_slice1z#TestParforsSlice.test_parfor_slice1	  s    	
 	

9bggbk*rX   c                 L   d }| j                  |t        j                  d      d       | j                  t              5 }  t        d      |      t        j                  d      d       d d d        | j                  dt        j                               y # 1 sw Y   /xY w)Nc                 >    | j                   \  }| d|dz
   | d| z   }|S r  r  r   r-  r   r   s       rV   r  z6TestParforsSlice.test_parfor_slice2.<locals>.test_impl	  s,    77DQ!AaC1Qq6!AHrX   r   ry  Tr   do not match	r   r   r  r  r  r   r   r  r  r  s      rV   test_parfor_slice2z#TestParforsSlice.test_parfor_slice2	  sy    	 	

9bggbk1-~.&*D$	*2772;r: /nc&*:*:&;< /.s   -BB#c                 T    d }| j                  |t        j                  d             y )Nc                 ^    | j                   \  }}| d|dz
  d|dz
  f   | d|d|f   z   }|S r  r  r  s       rV   r  z6TestParforsSlice.test_parfor_slice3.<locals>.test_impl	  sF    GGEQq!AaC%!A#+1Q3qs7+AHrX   r   r   r  r  s     rV   test_parfor_slice3z#TestParforsSlice.test_parfor_slice3	      	
 	

9bggen-rX   c                 T    d }| j                  |t        j                  d             y )Nc                 X    | j                   \  }}| d d d|dz
  f   | d d d|f   z   }|S r  r  r  s       rV   r  z6TestParforsSlice.test_parfor_slice4.<locals>.test_impl	  s:    GGEQq!AacE'
Qq1uX%AHrX   r"  r  r  s     rV   test_parfor_slice4z#TestParforsSlice.test_parfor_slice4	  r$  rX   c                 T    d }| j                  |t        j                  d             y )Nc                 X    | j                   \  }}| d|dz
  d d f   | d|d d f   z   }|S r  r  r  s       rV   r  z6TestParforsSlice.test_parfor_slice5.<locals>.test_impl	  s:    GGEQq!AaC%'
Qqs1uX%AHrX   r"  r  r  s     rV   test_parfor_slice5z#TestParforsSlice.test_parfor_slice5	  r$  rX   c                 T    d }| j                  |t        j                  d             y )Nc                 L    | j                         }| dd d f   |d d df   z   }|S r  	transposer   r   r  s      rV   r  z6TestParforsSlice.test_parfor_slice6.<locals>.test_impl	  s+    A!A#1Q3AHrX   r"  r  r  s     rV   test_parfor_slice6z#TestParforsSlice.test_parfor_slice6	  r$  rX   c                 H   d }| j                  |t        j                  d             | j                  t              5 }  t        d      |      t        j                  d             d d d        | j                  dt        j                               y # 1 sw Y   /xY w)Nc                 L    | j                         }| dd d f   |dd d f   z   }|S r  r-  r/  s      rV   r  z6TestParforsSlice.test_parfor_slice7.<locals>.test_impl	  s+    A!A#1Q3AHrX   rL  Tr   r  r  r  r  s      rV   test_parfor_slice7z#TestParforsSlice.test_parfor_slice7	  su    	 	

9bggen-~.&*D$	*2775>: /nc&*:*:&;< /.s   ,BB!c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 l    | j                   \  }}| j                         }| d|d|f   |d|d|f<   |S r  rd  r.  r  s       rV   r  z6TestParforsSlice.test_parfor_slice8.<locals>.test_impl	  sD    GGEQqA1Q3qs7Aac!A#gJHrX   ry  rL  r   r   r  r   r  s     rV   test_parfor_slice8z#TestParforsSlice.test_parfor_slice8	  *    	 	

9biil2259:rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 l    | j                   \  }}| j                         }| d d d|f   |d|d|f<   |S r  r6  r  s       rV   r  z6TestParforsSlice.test_parfor_slice9.<locals>.test_impl	  s@    GGEQqA1QqS5Aac!A#gJHrX   rc  r  r7  r  s     rV   test_parfor_slice9z#TestParforsSlice.test_parfor_slice9	  s*    	 	

9biim33E:;rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 d    | j                   \  }}| j                         }| dd|f   |dd|f<   |S r  r6  r  s       rV   r  z7TestParforsSlice.test_parfor_slice10.<locals>.test_impl	  s<    GGEQqA1Q3xAa!eHHrX   ry  rL  r7  r  s     rV   test_parfor_slice10z$TestParforsSlice.test_parfor_slice10	  r9  rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 r    | j                   \  }}}| j                         }| d d dd|f   |d d dd|f<   |S r  rd  r   )r   r-  r   rp  r   s        rV   r  z7TestParforsSlice.test_parfor_slice11.<locals>.test_impl	  sB    ggGQqA1Qqs7Aa!A#gJHrX      )r   r   r   r7  r  s     rV   test_parfor_slice11z$TestParforsSlice.test_parfor_slice11	  s*    	 	

9biim33G<=rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 d    | j                   \  }}| j                         }| dd df   |dddf<   |S )Nr   r   rI   rB  r  s       rV   r  z7TestParforsSlice.test_parfor_slice12.<locals>.test_impl	  s<    GGEQqA!CRC%Aa"fIHrX   rc  r  r7  r  s     rV   test_parfor_slice12z$TestParforsSlice.test_parfor_slice12	  *    	 	

9biim33E:;rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 p    | j                   \  }}| j                         }d}| d| |dz
  f   |dd|f<   |S )NrI   r   r   rB  )r   r-  r   r   r  s        rV   r  z7TestParforsSlice.test_parfor_slice13.<locals>.test_impl	  sG    GGEQqAAA2ac6{Aa!eHHrX   rc  r  r7  r  s     rV   test_parfor_slice13z$TestParforsSlice.test_parfor_slice13	  s*    	 	

9biim33E:;rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 d    | j                   \  }}| j                         }| dddf   |dd df<   |S )Nr   r   r   rI   rB  r  s       rV   r  z7TestParforsSlice.test_parfor_slice14.<locals>.test_impl 
  s<    GGEQqA2a4yAaeHHrX   rc  r  r7  r  s     rV   test_parfor_slice14z$TestParforsSlice.test_parfor_slice14	  rI  rX   c                 r    d }| j                  |t        j                  d      j                  d             y )Nc                 l    | j                   \  }}| j                         }| dddf   |d|dz
   d f<   |S )Nr   rO  r   r   rB  r  s       rV   r  z7TestParforsSlice.test_parfor_slice15.<locals>.test_impl	
  s@    GGEQqAQr!tV9Aa!A#iLHrX   rc  r  r7  r  s     rV   test_parfor_slice15z$TestParforsSlice.test_parfor_slice15
  rI  rX   c                     d }| j                  |t        j                  d      t        j                  d      d       t        j
                  dd t        j
                  dd t        j                  f}| j                  t        ||      d       y)z This test is disabled because if n is larger than the array size
            then n and n-1 will both be the end of the array and thus the
            slices will in fact be of different sizes and unable to fuse.
        c                 \    | j                   |j                   k(  sJ d| d| d|d|dz
   | |z  S Nr   r   r   r  )r   r   r   s      rV   r  z7TestParforsSlice.test_parfor_slice16.<locals>.test_impl
  s;    77agg%&%AaFAa1Jq5LrX   r      Nr   )	r   r   r  r$  r   r{  rv  r   r   rS   r  r   s      rV   test_parfor_slice16z$TestParforsSlice.test_parfor_slice16
  sd    	 	

9bggbk288B<;a %--"2EKK@i6:rX   c                 V    d }| j                  |dt        j                  d             y )Nc                 R    t        j                  |       }t        |      }||| d  |S rZ   r   r$  r   )r-  ri  r  r   s       rV   r  z7TestParforsSlice.test_parfor_slice17.<locals>.test_impl"
  s*    AAAAqbcFHrX   r   r  r  s     rV   test_parfor_slice17z$TestParforsSlice.test_parfor_slice17!
  s!    	 	

9b"''"+.rX   c                 ,    d }| j                  |       y )Nc                  l    t        j                  d      } t        j                  dd      | dd | d   }|S )Nr   r   rH  r   rW  r   )r   r$  r  )r   rQ  s     rV   r  z7TestParforsSlice.test_parfor_slice18.<locals>.test_impl,
  s2    AYYq!_AaF!AHrX   r  r  s     rV   test_parfor_slice18z$TestParforsSlice.test_parfor_slice18*
  s    	 	

9rX   c                 T    d }| j                  |t        j                  d             y )Nc                 "    | d dxxx dz  ccc | S r  r|   r  s    rV   r  z7TestParforsSlice.test_parfor_slice19.<locals>.test_impl6
  s    bqEQJEHrX   r   r  r  s     rV   test_parfor_slice19z$TestParforsSlice.test_parfor_slice194
      	 	

9bggbk*rX   c                 0    d }| j                  |d       y )Nc                  P    t        j                  d      } | dd  }t        |      }|S )Nr   r   )r   r  r   )r   r  r  s      rV   r  z7TestParforsSlice.test_parfor_slice20.<locals>.test_impl>
  s(    A!"AAAHrX   FrI  r  r  s     rV   test_parfor_slice20z$TestParforsSlice.test_parfor_slice20<
  s    	 	

9u
5rX   c                     d }t         j                  j                  d      }t         j                  j                  d      }| j                  |||       y )Nc                     | j                  | j                  d      } |j                  |j                  d      }| |d dd d f   k\  S )Nr   rI   )r   r  )x1x2s     rV   r  z7TestParforsSlice.test_parfor_slice21.<locals>.test_implG
  sA    BGGQ'BBGGQ'BCRCF##rX   r   r   )r   rr  r  r   rS   r  rj  rk  s       rV   test_parfor_slice21z$TestParforsSlice.test_parfor_slice21F
  s=    	$
 YY^^AYY^^A

9b"%rX   c                     d }t        j                  d      }t        j                  d      }| j                  |||       y )Nc                 h    t        j                  d      }t        d      D ]  }|| d d |f   z  } |S r}  )r   r$  r   )rj  rk  r   r   s       rV   r  z7TestParforsSlice.test_parfor_slice22.<locals>.test_implQ
  s3    AAYR2Y HrX   )r   rH  r   )r   r$  re  r   rl  s       rV   test_parfor_slice22z$TestParforsSlice.test_parfor_slice22P
  s4    	 XXfXXa[

9b"%rX   c                 T    d }| j                  |t        j                  d             y )Nc                     d| d d | S )Nr   r   r|   r!  s    rV   r  z7TestParforsSlice.test_parfor_slice23.<locals>.test_impl]
  s    AbqEHrX   r   r  r  s     rV   test_parfor_slice23z$TestParforsSlice.test_parfor_slice23[
  rd  rX   c                 z    d }t        dd      D ])  }| j                  |dt        j                  d      |       + y )Nc                 V    t        j                  |       }||d  }|d t        |       }|S rZ   r\  r-  ri  r   r  r  s        rV   r  z7TestParforsSlice.test_parfor_slice24.<locals>.test_impld
  s.    A!"A'3q6
AHrX   rP  r   r   r   r   r  rS   r  r   s      rV   test_parfor_slice24z$TestParforsSlice.test_parfor_slice24c
  3    	 sBAJJy"bggbk15  rX   c                 z    d }t        dd      D ])  }| j                  |dt        j                  d      |       + y )Nc                 V    t        j                  |       }|d | }|d t        |       }|S rZ   r\  rv  s        rV   r  z7TestParforsSlice.test_parfor_slice25.<locals>.test_impln
  s.    A"1A'3q6
AHrX   rw  rP  r   rx  ry  s      rV   test_parfor_slice25z$TestParforsSlice.test_parfor_slice25m
  r{  rX   c                 T    d }| j                  |t        j                  d             y )Nc                 Z    | j                   \  }| j                         }| dd ||dz
   d  |S )NrO  r   r   rB  r  s      rV   r  z7TestParforsSlice.test_parfor_slice26.<locals>.test_implx
  s4    77DQA2aA!fgJHrX   r   r   r   r  r  s     rV   test_parfor_slice26z$TestParforsSlice.test_parfor_slice26w
  s    	 	

9biil+rX   c                 T    d }| j                  |t        j                  d             y )Nc                 l    d}t        | j                  d         D ]  }| |   dk7  r|dz  }|s| d | } yr  r  )r   n_valid_valsr   unuseds       rV   r  z7TestParforsSlice.test_parfor_slice27.<locals>.test_impl
  sG    LAGGAJ'Q419 A%L}-F ( rX   r   r  r  s     rV   test_parfor_slice27z$TestParforsSlice.test_parfor_slice27
  s    
	 	

9biil+rX   c           	      >   t        ddd       t        dd d       t        d dd      t        d d d       t        d d d      fD ][  fd}d}| j                  ||       t        j                  |dz        j	                  |df      }fd	}| j                  ||       ] y )
Nr   r   r   rI   rG  c                     t        j                  | dz        j                  | df      }d}t        j                  |       D ]  }|||f   j                         z  } |S Nr   r   )r   r  r   r   r   rg  )r   r^  rQ  r   tss       rV   r  zHTestParforsSlice.test_parfor_array_access_lower_slice.<locals>.test_impl
  sX    IIa!e$,,aV4aA1b5'A )rX   r   r   c                     d}t        j                  | j                  d         D ]  }|| |f   j                         z  } |S r  )r   r   rd  rg  )r^  rQ  r   r  s      rV   r  zHTestParforsSlice.test_parfor_array_access_lower_slice.<locals>.test_impl
  s@    aggaj1A1b5'A 2rX   )slicer   r   r  r   )rS   r  r   r^  r  s       @rV   $test_parfor_array_access_lower_slicez5TestParforsSlice.test_parfor_array_access_lower_slice
  s    At$eAtT&:E$2<NtT*E$b,ACB AJJy!$		!a% ((!Q0A JJy!$+CrX   N) rw   rN   rx   r  r  r#  r'  r*  r0  r3  r=   r8  r<  r?  rD  rH  rL  rP  rS  rY  r]  r`  rc  rg  rm  rp  rs  rz  r~  r  r  r  r|   rX   rV   r  r  	  s    +=....= ; ; < < ; ;><<<< ; ;/+6&	&+66,,"%rX   r  c                       e Zd Zd Zy)TestParforsOptionsc                 :   d }| j                  |t        j                  d             t        j                  d d  f}| j                  t        ||      d       | j                  t        ||d      d       | j                  t        ||dd      d       | j                  t        ||ddd	      d
       | j                  t        ||dddd      d       | j                  t        ||ddddd      d       | j                  t        ||dddddd      d       y )Nc                    | j                   d   }t        j                  |      }t        j                  t	        |      D cg c]  }| c}      }| ||z  z   |d | t        |      D ]  }||   | |   z  ||<    t        d |d      S c c}w )Nr   c                     | |z   S rZ   r|   r  s     rV   r  zKTestParforsOptions.test_parfor_options.<locals>.test_impl.<locals>.<lambda>
  s    QqSrX   )rd  r   r  re  r   r   r   )r   r   r   r   r  s        rV   r  z9TestParforsOptions.test_parfor_options.<locals>.test_impl
  s    
A
AeAh0h1h01AAIAbqEAYtad{! .!Q//	 1s   	Br   r   F)fusionr   )r  comprehensionr   )r  r  setitemr   )r  r  r  r   r   )r  r  r  r   	reductionr   )r  r  r  r   r  r  r   )r   r   r  r   r{  r   r   rX  s      rV   test_parfor_optionsz&TestParforsOptions.test_parfor_options
  s&   	0 	

9bggbk*a "i6:ieDaHie',./0	2 	ie',e=>?	A 	ie',eEKLM	O 	ie',eE#(*+,	. 	ie',eE#(789	;rX   N)rw   rN   rx   r  r|   rX   rV   r  r  
  s     ;rX   r  c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestParforsBitMaskc                 V    d }| j                  |t        j                  d      d       y )Nc                     | |kD  }d| |<   | S r  r|   r  s      rV   r  z:TestParforsBitMask.test_parfor_bitmask1.<locals>.test_impl
  s    AAAaDHrX   r   r   r  r  s     rV   test_parfor_bitmask1z'TestParforsBitMask.test_parfor_bitmask1
  s!    	
 	

9biimQ/rX   c                 d    d }t        j                  d      }|dkD  }| j                  |||       y )Nc                     d| |<   | S r  r|   r   s     rV   r  z:TestParforsBitMask.test_parfor_bitmask2.<locals>.test_impl
      AaDHrX   r   r   r  r9  s       rV   test_parfor_bitmask2z'TestParforsBitMask.test_parfor_bitmask2
  /    	 IIbME

9a#rX   c                 d    d }t        j                  d      }|dkD  }| j                  |||       y )Nc                     | |   | |<   | S rZ   r|   r   s     rV   r  z:TestParforsBitMask.test_parfor_bitmask3.<locals>.test_impl
  s    Q4AaDHrX   r   r   r  r9  s       rV   test_parfor_bitmask3z'TestParforsBitMask.test_parfor_bitmask3
  r  rX   c                 d    d }t        j                  d      }|dkD  }| j                  |||       y )Nc                     d| z  |   | |<   | S rc  r|   r   s     rV   r  z:TestParforsBitMask.test_parfor_bitmask4.<locals>.test_impl
  s    E1:AaDHrX   r   r   r  r9  s       rV   test_parfor_bitmask4z'TestParforsBitMask.test_parfor_bitmask4
  r  rX   c                 d    d }t        j                  d      }|dkD  }| j                  |||       y )Nc                 "    | |   | |   z  | |<   | S rZ   r|   r   s     rV   r  z:TestParforsBitMask.test_parfor_bitmask5.<locals>.test_impl
  s    Q4!A$;AaDHrX   r   r   r  r9  s       rV   test_parfor_bitmask5z'TestParforsBitMask.test_parfor_bitmask5
  r  rX   c                 @   d }t        j                  d      }|dkD  }t        j                  t        |            }| j	                  t
              5 }| j                  ||||       d d d        | j                  dt        j                               y # 1 sw Y   /xY w)Nc                     || |<   | S rZ   r|   r/  s      rV   r  z:TestParforsBitMask.test_parfor_bitmask6.<locals>.test_impl   r  rX   r   r   r  )
r   r  r$  rg  r  r  r   r   r  r  )rS   r  r   r   r  r  s         rV   test_parfor_bitmask6z'TestParforsBitMask.test_parfor_bitmask6
  s}    	 IIbMEHHSV ~.&JJy!Q* /4c&:J:J6KL /.s   BBN)	rw   rN   rx   r  r  r  r  r  r  r|   rX   rV   r  r  
  s!    0$$$$MrX   r  c                       e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zed        Zd Zd Zd Zd Zd Zd Zed        Zd Zd Zd Zd Zd Zy)TestParforsMiscz?
    Tests miscellaneous parts of ParallelAccelerator use.
    c                 *   d } t        dd      |      }t        j                  d      5 }t        j                  d       t        j                  dd       t        j                  dd	t
        j                  j                  d
        |        d d d        | j                  t              d       |j                  j                         D cg c]  }|j                  j                   }}| j                  |dg       y # 1 sw Y   sxY wc c}w )Nc                  ~    t        j                  d      } t        | j                        D ]  }| |xx   |z  cc<    | S r  )r   r  r   r  )r  r   s     rV   r   z9TestParforsMisc.test_no_warn_if_cache_set.<locals>.pyfunc  s4    ''#,CCHH%A! &JrX   T)r   cacherecordalwaysignore	typeguard)actionmodulez.*TBB_INTERFACE_VERSION.*znumba\.np\.ufunc\.parallel.*)r  messagecategoryr  r   F)r   warningscatch_warningssimplefilterfilterwarningsr   r   NumbaWarningr   r   r   r  r   has_dynamic_globals)rS   r   r   raised_warningsr   r  s         rV   test_no_warn_if_cache_setz)TestParforsMisc.test_no_warn_if_cache_set  s    	 0d$/7$$D1_!!(+##8+68 ##8,H-2\\-F-F+JL G 2 	_-q1 ,1??+A+A+CE+C4  $||??+C 	 E,ug6! 21Es   A%DDDc                     d }| j                  |d      }t               5 }|j                          d d d        j                         j	                         D ]  }| j                  d|        y # 1 sw Y   ?xY w)Nc                      t        j                  d      } t        j                  dd      | dd t        d| d          t        d| d          | S )Nr   r   rH  r   rW  za[3]:r   )r   r$  r  printre  s    rV   r   zITestParforsMisc.test_statement_reordering_respects_aliasing.<locals>.impl0  sE    AYYq!_AaF'1Q4 '1Q4 HrX   r|   z	a[3]: 2.0)r   r4   r   getvaluer(  r   )rS   r   r   stdoutlines        rV   +test_statement_reordering_respects_aliasingz;TestParforsMisc.test_statement_reordering_respects_aliasing/  sg    	 $$T2.& OO%002D[$/ 3 s   A//A8c                    d }t        j                  t         j                  dg      } t        d      |      }t        j
                  j                  j                  }	 dt        j
                  j                  _        t         j                  j                   ||       ||             |t        j
                  j                  _        y # |t        j
                  j                  _        w xY w)Nc                 ,    t        j                  |       S rZ   )r   isinfr  s    rV   r  z;TestParforsMisc.test_parfor_ufunc_typing.<locals>.test_impl>  s    88A;rX   r  Tr   )
r   re  r  r   r   r  r  sequential_parfor_loweringr   assert_array_equal)rS   r  ri  r   old_seq_flags        rV   test_parfor_ufunc_typingz(TestParforsMisc.test_parfor_ufunc_typing=  s    	 HHbffc]##d#I.}}++FF	K>BEMM  ;JJ)))A,aA ?KEMM  ;lEMM  ;s    AC !C,c                 B    d }| j                  t        |d      d       y )Nc                      d} g d}t         j                  j                  j                          |}t        j                  d      D ]
  }| ||   z  }  | |d   z   S )Nr   r  r   r   )r   r  r  init_pranger   )resr  dummyr   s       rV   r  z6TestParforsMisc.test_init_block_dce.<locals>.test_implN  sT    CCMM  ,,.E\\!_s1v %q>!rX   r|   r   )r   r  r  s     rV   test_init_block_dcez#TestParforsMisc.test_init_block_dceL  s!    	" 	,Y;Q?rX   c                 ,    d }| j                  |       y )Nc                  `    d} t        d      D ]  }| dz  } 	 t        j                  | f      }|S )Nr   r   r   r   r   r$  )r  rJ   r  s      rV   r  zBTestParforsMisc.test_alias_analysis_for_parfor1.<locals>.test_implZ  s5    C1Xq  88SF#DKrX   r  r  s     rV   test_alias_analysis_for_parfor1z/TestParforsMisc.test_alias_analysis_for_parfor1Y  s    	 	

9rX   c                 "   dt        dd       G fddt                      G fddt              }t        d|	      d
        }| j	                  t
        j                  j                  j                         | j                  t        j                        5 } |        d d d        | j                  t        j                               | j	                  t
        j                  j                  j                         y # 1 sw Y   bxY w)N
BROKEN_MSGTF)mutates_CFGanalysis_onlyc                   "    e Zd ZdZd Z fdZy)VTestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParforsbreak_parforsc                 .    t        j                  |        y rZ   )r1   r  r\   s    rV   r  z_TestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParfors.__init__o  s    %%d+rX   c                    |j                   j                  j                         D ]`  }|j                  D ]N  }t	        |t
        j                  j                  j                        s2 G fddt              } |       |_
        P  y y )Nc                       e Zd Z fdZy)oTestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParfors.run_pass.<locals>.Brokenc                 .    t        j                        rZ   )r   LoweringError)rS   otherr  s     rV   
differencezzTestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParfors.run_pass.<locals>.Broken.difference~  s    *0*>*>z*J$JrX   N)rw   rN   rx   r  r  s   rV   Brokenr  |  s	    !KrX   r  T)rw  r  r  r  r   r   r  r  r  r   races)rS   r  blkr  r  r  s        rV   run_passz_TestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParfors.run_passr  sf     ==//668C #%dEMM,@,@,G,GHK K
 *0DJ !)   9rX   N)rw   rN   rx   _namer  r  r  s   rV   BreakParforsr  k  s    #E, rX   r  c                       e Zd Z fdZy)^TestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParforsCompilerc                     t        j                  | j                        }|j                  t               |j                          |gS rZ   )r/   define_nopython_pipeliner  add_pass_afterr2   finalize)rS   pmr  s     rV   define_pipelineszoTestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.BreakParforsCompiler.define_pipelines  s7    '@@L!!,?trX   N)rw   rN   rx   r  )r  s   rV   BreakParforsCompilerr    s    rX   r  )r   pipeline_classc                  4    d} t        d      D ]  }| dz  } 	 | S r  r  )r   rJ   s     rV   foozMTestParforsMisc.test_no_state_change_in_gufunc_lowering_on_error.<locals>.foo  s#    AAYQ HrX   )r0   r1   r.   r   assertFalser   r  r  r  r  r   r  r   r  r  )rS   r  r  r  r  r  s       @@rV   0test_no_state_change_in_gufunc_lowering_on_errorz@TestParforsMisc.test_no_state_change_in_gufunc_lowering_on_errord  s    
 "
	4u	=	 < 	  
>	 2	< 	 
t,@	A	 
B	 	--HHIv334E 5 	j#f&6&6"78 	--HHI 54s   DDc                   	  G d dt         j                        } |d      	 t        |      t        j                          G d dt
              }t        j                  |      	fd       }t        |      d        }t        |dd	d
i      d        }t        d        t        fd       }t        j                  j                  j                  }| j                  |       	  | |              | j                  t        j                  j                  j                         |t        j                  j                  _        y # |t        j                  j                  _        w xY w)Nc                       e Zd Zy)2TestParforsMisc.test_issue_5098.<locals>.DummyTypeNrw   rN   rx   r|   rX   rV   	DummyTyper        rX   r  my_dummyc                       e Zd Zy).TestParforsMisc.test_issue_5098.<locals>.DummyNr  r|   rX   rV   Dummyr	    r  rX   r
  c                     S rZ   r|   )valr  
dummy_types     rV   typeof_Dummyz5TestParforsMisc.test_issue_5098.<locals>.typeof_Dummy  s	    rX   c                 H    t        |j                  j                               S rZ   )r"   contextget_dummy_value)typobjr  s      rV   unbox_indexz4TestParforsMisc.test_issue_5098.<locals>.unbox_index  s    qyy88:;;rX   method1r   T)jit_optionsc                     d }|S )Nc                     d }t        |      }t        j                  |t        j                        }t	        |      D ]  } |||   |      ||<    t	        |dz
        D ]  }||xx    |||   |      z  cc<    |S )Nc                 ~    | j                         }t        j                  |t        j                  |       <    ||      S rZ   )r   r   r  r  )r   fr  s      rV   bazzPTestParforsMisc.test_issue_5098.<locals>._get_method1.<locals>._foo.<locals>.baz  s+    A%'VVAbhhqkNQ4KrX   r
  r   r  )r  r  r   r  length
output_arrr   s          rV   _foozCTestParforsMisc.test_issue_5098.<locals>._get_method1.<locals>._foo  sz     
 SXXfBJJ?
A$'A$5JqM (
+AqMSQ%66M ,!!rX   r|   )r  r  r   r  s       rV   _get_method1z5TestParforsMisc.test_issue_5098.<locals>._get_method1  s    " KrX   c                 "    | j                         S rZ   r  )r  s    rV   barz,TestParforsMisc.test_issue_5098.<locals>.bar  s    668OrX   c                 Z    | j                  t        j                  g dg dg            S )NrF  r  r  )r  r5  r6  )r  r   re  )r  r!  s    rV   test1z.TestParforsMisc.test_issue_5098.<locals>.test1  s"    99RXX&HI3OOrX   )r   Opaquer   r#   OpaqueModelobjectr    registerr!   r   r   r   r  r  r  r  )
rS   r  r
  r  r  r  r$  
save_stater!  r  s
           @@rV   test_issue_5098zTestParforsMisc.test_issue_5098  s?   	 	 z*
!y!&"4"45	F 	 
		e	$	 
%	 
y		< 
	< 
IJt;L	M	 
N	  
	 
	 
	P 
	P ]]))DD
$	I%'NU]]11LLM ?IEMM  ;jEMM  ;s   &A E !E'c                 T   t        d      d        }t        dd      5  | j                  t        j                        5 } |d       d d d        d d d        t        j                        }| j                  d|       | j                  d|       y # 1 sw Y   KxY w# 1 sw Y   OxY w)	NTr   c                 >    d}d}t        d      D ]
  }|||    z  } |S )N)r   r   r   r   r   r   r  )idxbig_tupr2  r   s       rV   oversize_tuplezMTestParforsMisc.test_oversized_tuple_as_arg_to_kernel.<locals>.oversize_tuple  s-    GABZWS\!  HrX   NUMBA_PARFOR_MAX_TUPLE_SIZE3r   zUse of a tuplezin a parallel region)r   r6   r  r   rU  r  r  r   )rS   r/  r  errstrs       rV   %test_oversized_tuple_as_arg_to_kernelz5TestParforsMisc.test_oversized_tuple_as_arg_to_kernel  s    	t		 
	 !!>D""6#A#ABfq! C E V%%&&/,f5 CB EDs"    B	BBB	BB'c                     d }d}t         j                  j                  dd|      }t         j                  j                  dd|      }| j                  |||       y )Nc                    d}t        j                  | j                  || j                        }| j                  }t	        |d         D ]9  }t	        |d         D ]&  }| ||f   |||f   z
  | ||f   |||f   z   z  |||f<   ( ; |S Nr   r
  r   )r   fullrd  r  r   )img_nirimg_red	fillvalueout_imgdimsrQ  r   s          rV   	ndvi_njitz1TestParforsMisc.test_issue5167.<locals>.ndvi_njit  s    IgggmmYgmmLG==DDG_QA&-admgadm&C&-admgadm&C&EGAqDM ) % NrX   )r   r   rF  g     @)lowr  r  )r   rr  uniformr   )rS   r=  
tile_shapearray1array2s        rV   test_issue5167zTestParforsMisc.test_issue5167  sT    	 
""sz"J""sz"J

9ff-rX   c                 "   d }t         d        }t        j                  j                  d      }  t        d      |      |j                         |d      } ||j                         |d      }t        j                  j                  ||       y )Nc                 @   t        j                  | j                  d   | j                  d   ft         j                        }t	        | j                  d         D ]A  }t        |dz   | j                  d         D ]   } || |   | |   g| }||||f<   ||||f<   " C |S r6  )r   r$  rd  r  r   r   )r   rr  	dist_argsr  r   rq  r  s          rV   
reproducerz2TestParforsMisc.test_issue5065.<locals>.reproducer  s    XXqwwqz1771:6bjjIFAGGAJ'q1uaggaj1AQqT1Q44)4A#$F1a4L#$F1a4L 2 (
 MrX   c                     d}t        | j                  d         D ]  }|| |   ||   z
  dz  z  } t        j                  |      S )Nr  r   r   )r   rd  r   rH  )r   rQ  r  r   s       rV   	euclideanz1TestParforsMisc.test_issue5065.<locals>.euclidean  sG    F1771:&1Q4!A$;1,, '776?"rX   )r   r   r  Tr   r|   )r   r   rr  r   r   r  )rS   rG  rI  r   rr  rs  s         rV   test_issue5065zTestParforsMisc.test_issue5065  s    	 
	# 
	# II&)-!dD!*-affh	"Eaffh	"5


""31rX   c                     d }t        j                  d      t        j                  d      f}| j                  ||       y )Nc                 x    dgt        |       z  }t        t        |             D ]  }t        | |         ||<    |S r  )r   r   )myarrayr  r   s      rV   test_numba_parallelz;TestParforsMisc.test_issue5001.<locals>.test_numba_parallel  s;    S3w<'FCL)
Oq	 *MrX   r  2   )r   r  r   )rS   rN  rM  s      rV   test_issue5001zTestParforsMisc.test_issue5001  s2    	 88C=".

&0rX   c                 `    t         d        t        d      fd       } |dgfdz         y )Nc                      y rZ   r|   )gridss    rV   r  z+TestParforsMisc.test_issue3169.<locals>.foo      rX   Tr   c                 6    t        d      D ]
  } |         y r  r  )rS  r   r  s     rV   r!  z+TestParforsMisc.test_issue3169.<locals>.bar"  s    AYE
 rX   r   r   ru  )rS   r!  r  s     @rV   test_issue3169zTestParforsMisc.test_issue3169  s?    		 
	 
t		 
	
 	aSFQJrX   c                     t        dd      }fd}t        d      d         |dd      }| j                  ||       y )	Nmytyper   c                 N    t        d      D ]  } ||         | j                  S r^  )r   r   )mydatar   inners     rV   outerz-TestParforsMisc.test_issue4846.<locals>.outer/  s$    AYa  88OrX   T)nogilc                 <    | |j                   f}| |j                  f}y rZ   r   )r   rZ  r  r  s       rV   r[  z-TestParforsMisc.test_issue4846.<locals>.inner4  s    FHHAFHHArX   r   r   )r   r   r   )rS   rX  r\  rZ  r[  s       @rV   test_issue4846zTestParforsMisc.test_issue4846*  sK     Hj1	
 
D		 
	 #%

5&!rX   c                 ,    d }| j                  |       y )Nc                  P    d} d}t        t        |             D ]
  }|| |   z  } |S )Nr  r   r   r   )r   r   r   s      rV   test1bz.TestParforsMisc.test_issue3748.<locals>.test1b?  s0    AACF^QqT	 $HrX   r  )rS   rc  s     rV   test_issue3748zTestParforsMisc.test_issue3748=  s    	 	

6rX   c                 j    d }d}t        j                  |t              }| j                  |||       y )Nc                 n    t        | d         D ]#  }t        | d         D ]  }|dz  |z   ||   |<    % |S )Nr   r   g      @r  )r  r  r   rQ  s       rV   parallel_testz5TestParforsMisc.test_issue5277.<locals>.parallel_testJ  sB    DG_QA !C!CF1I ) % JrX   r  r
  )r   r$  r  r   )rS   rg  r  r  s       rV   test_issue5277zTestParforsMisc.test_issue5277H  s.    	 hht3'

=$,rX   c                     t        d      d        }t        j                  d      }d}t        j                  d      }| j                   ||||      |j	                  |||             y )NTr   c                 b    t        d      D ]  }t        d      D ]	  }d|||f<     |r|dz  }|S r  r   r   )r   methodr  r   rq  s        rV   r  z5TestParforsMisc.test_issue5570_ssa_races.<locals>.fooV  s>    AYqA !C1I "  qJrX   )r   r   9   r)  )r   r   r$  rn  r  )rS   r  r   rl  r  s        rV   test_issue5570_ssa_racesz(TestParforsMisc.test_issue5570_ssa_racesU  se    	t		 
	 hhuohhvVS!KKVS)	
rX   c                     t        d      d        }t        j                  j                  d       t        j                  j                  d      }| j	                   ||      |j                  |             y )NTr   c                 j    | }t        dd      D ]  }||d d d d f   } t        j                        S )Nr   r   )r   r   r  )r   packager  z_stacks       rV   find_maxima_3D_jitzDTestParforsMisc.test_issue6095_numpy_max.<locals>.find_maxima_3D_jiti  s5    Gq"!%A+. &66'?"rX   r   )r   r   r   )r   r   rr  r  rn  r  )rS   rs  r   s      rV   test_issue6095_numpy_maxz(TestParforsMisc.test_issue6095_numpy_maxh  sc    	t		# 
	# 			qyy-t$&&t,	
rX   c                     d }d}d}t        j                  ||ft         j                        }t        j                  ||ft         j                        }| j                  |||       y )Nc                     | j                   }|d   }t        |      D ]!  }| |d d f   ||d d f<   ||dfxx   dz  cc<   # |S r  )rd  r   )gggg_nextgsr  i_ggs        rV   r  z3TestParforsMisc.test_issue5942_1.<locals>.test_implz  sS    B1Aq	$&tQwKa a A%  " NrX   r   r   r
  )r   r$  r   r   )rS   r  r  r   rw  rx  s         rV   test_issue5942_1z TestParforsMisc.test_issue5942_1w  sS    	 ((Aq62884((Aq62884

9b'*rX   c                 8    d }d}d}| j                  |||       y )Nc                 .   t        j                  | |ft         j                        }t        j                  | |ft         j                        }t        |       D ]8  }t	        |      D ]	  }||||f<    ||d d f   ||d d f<   ||dfxx   dz  cc<   : |S )Nr
  r   r   )r   r$  r   r   r   )r  r   rw  rx  rz  r   s         rV   r  z3TestParforsMisc.test_issue5942_2.<locals>.test_impl  s    hh1vrxx8Bhh1vrxx8Gq	qA"&BtQwK "$&tQwKa a A% 	 " NrX   r   r   r  )rS   r  r  r   s       rV   test_issue5942_2z TestParforsMisc.test_issue5942_2  s#    
	 

9a#rX   c                     t        d      d        }t        j                  g dg dg      }| j                   ||      |j	                  |             y )NTr   c                    t        | j                  d         D ]  }t        j                  }t        j                  g dt        j
                        }dD ][  }t        j                  j                  | |d d f   |z         }||k  s2|}t        j                  |||gt        j
                        }] | |d d fxx   |z  cc<    | S )Nr   )r   r   r   r
  )r   r   rI   )r   rd  r   r  re  r  r<  norm)r  r   rr  trr   dist_ts         rV   r  z)TestParforsMisc.test_issue6102.<locals>.f  s    QWWQZ(vvXXirzz:#AYY^^Ab!eHqL9F}%XXq!QirzzB	 $
 "a%B ) HrX   )r  r  r  )r  r  rF  )r   r   re  rn  r  )rS   r  r  s      rV   test_issue6102zTestParforsMisc.test_issue6102  sL     
t	
	 

	 HHlL12!aiil3rX   c                 ,    d }| j                  |       y )Nc                      d} t        j                  | f      }t        j                  | dz
  f      }t        t	        |            D ]   }t        j
                  |||dz          ||<   " |S rz  )r   r  r  r   r   rg  )r   na_maskr  r   s       rV   r  z1TestParforsMisc.test_issue6774.<locals>.test_impl  s_    AggqdmGXXq1uh'FCK(FF71QU#34q	 )MrX   r  r  s     rV   test_issue6774zTestParforsMisc.test_issue6774  s    	 	

9rX   c                 ,    d }| j                  |       y )Nc                  D    t        j                  t        t        f      } | S rZ   )r   r$  _GLOBAL_INT_FOR_TESTING1_GLOBAL_INT_FOR_TESTING2)bufs    rV   r  z9TestParforsMisc.test_issue4963_globals.<locals>.test_impl  s    ((46NOPCJrX   r  r  s     rV   test_issue4963_globalsz&TestParforsMisc.test_issue4963_globals  s    	 	

9rX   c                 >    ddfd}| j                  |       y )Nr   r   c                  6    t        j                  f      } | S rZ   rl  )r  _FREEVAR_INT_FOR_TESTING1_FREEVAR_INT_FOR_TESTING2s    rV   r  z:TestParforsMisc.test_issue4963_freevars.<locals>.test_impl  s    ((57PQRCJrX   r  )rS   r  r  r  s     @@rV   test_issue4963_freevarsz'TestParforsMisc.test_issue4963_freevars  s"    $&!$%!	 	

9rX   c                     ddl m}m}m} t        j
                  d        t	        j
                  dd      fd       }|j                   | ||| ||      g             ||      f       y )Nr   )ListTypeTuplerw  c                      y rZ   r|   r!  s    rV   _sinkz>TestParforsMisc.test_issue_9182_recursion_error.<locals>._sink  rT  rX   FT)r  r   c                     t        t        |            D ]\  }| D ]U  }|d   }|d   }|dk(  r|d   }n(t        |      dk(  r|d   |d   }}nt        |      dk(  r	 |dk(  sF                W ^ y )Nr   r   r   r   rb  )	clausesnodespiterclauseclause_typeclause_variablesclause_var_1clause_var_2r  s	           rV   _ground_node_rulezJTestParforsMisc.test_issue_9182_recursion_error.<locals>._ground_node_rule  s    
  E
+%F"()K'-ay$"a''7':-.!3,Q/,Q/ '3
 -.!3"a'l+l+! & ,rX   )numba.typesr  r  rw  r   r   compile)rS   r  r  rw  r  r  s        @rV   test_issue_9182_recursion_errorz/TestParforsMisc.test_issue_9182_recursion_error  sr    55		 
	 
%$	/	, 
0	,. 	!!dHTN;<=	
rX   c                 r    t        d      d        }| j                   |       |j                                y )NTr   c                  t    d} t        d      D ]'  }t        d      D ]  }t        d      D ]  }| dz  } 	  ) | S r  rk  )r  r   r   rq  s       rV   r  z8TestParforsMisc.test_lookup_cycle_detection.<locals>.foo  sC     CAYqA"1Xq & "  JrX   r  )rS   r  s     rV   test_lookup_cycle_detectionz+TestParforsMisc.test_lookup_cycle_detection  s5     
t		 
	 	.rX   N)rw   rN   rx   rC  r  r  r  r  r  r   r*  r3  rC  rJ  rP  rV  r=   r_  rd  rh  rn  rt  r{  r~  r>   r  r  r  r  r  r  r|   rX   rV   r  r    s    780K@	:Jx3Ij6$."22	1 " "$	-
&
+&$& 4 4&
%
N/rX   r  c                   b    e Zd Zd Zd Zd Z	 	 	 ddZd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zy)TestParforsDiagnosticsc                 `     | j                   |g| \  }} | j                  |||g|i | y rZ   r   r   s         rV   r   zTestParforsDiagnostics.check  r	  rX   c                 l    | j                  |      }| j                  |      }| j                  ||       y rZ   )_fusion_equivalentr   )rS   rr  rs  r   r   s        rV   assert_fusion_equivalencez0TestParforsDiagnostics.assert_fusion_equivalence
  s2    ##C(##H-ArX   c                     t        t              }t        |j                               }t	        |j                               D ]  }||   D cg c]  }||z
  	 c}|||z
  <     |S c c}w rZ   )r   r   r  keyssorted)rS   thingnewmin_keyr   r   s         rV   r  z)TestParforsDiagnostics._fusion_equivalent  sb     $ejjl#

%A5:1X>XGX>CG &
  ?s   A%Nc                 *   | | j                  ||j                                || j                  ||j                         || j                  ||j                         |D|j
                  j                         }|D ]%  }|D ]  }	|	d   |k(  s  d|d|}
t        |
       |+|j                         }| j                  |t        |             t               5  t        dd      D ]  }|j                  |        	 d d d        y # 1 sw Y   y xY w)Nr   zReplacement for z was not found. Had r   r   )r   count_parforsr  fusion_infonested_fusion_infor  r  r  hoisted_allocationsr   r4   r   dump)rS   r  parfors_countr  r  r  r  replr   replacedr   hoisted_allocss               rV   assert_diagnosticsz)TestParforsDiagnostics.assert_diagnostics  s    $]K,E,E,GH"**;8O8OP)**+=+6+I+IK#++224D! $H{a' !% IJ4PC(-- " *(<<>N0#n2EF 1a[  # ! s   #D		Dc                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |ddddgi       y )	Nc                  d    d} t        j                  |       }t        j                  |       }||z   S Nr   rn  r   r   r   s      rV   r  z9TestParforsDiagnostics.test_array_expr.<locals>.test_impl;  s*    A
AAq5LrX   r|   parfor_diagnosticsr   r   r   r   )r  r  r   r   r  r  rS   r  r   r  s       rV   test_array_exprz&TestParforsDiagnostics.test_array_expr:  sX    	 	

9&&y"5oo&:;1/01a&k 	  	;rX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |d       y )Nc                  d    d} t        j                  |       }t        |       D ]
  }|dz  ||<    |S r  r   r  r   )r   r   r   s      rV   r  z5TestParforsDiagnostics.test_prange.<locals>.test_implH  s4    AAAY2v! HrX   r|   r  r   r  r  r  s       rV   test_prangez"TestParforsDiagnostics.test_prangeG  sI    	 	

9&&y"5oo&:;1=rX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  t	        d |j
                  D                     y)zEmake sure original user variable name is used in fusion info
        c                      d} t        j                  |       }t        j                  |      }t        j                  ||z        }d}t	        | dz
        D ]&  }t	        | dz
        D ]  }|||   ||dz      z   z  } ( |S )Nr   r   r   r   )r   r  sincosr   )r   r   r   r   r  r   rq  s          rV   r  z;TestParforsDiagnostics.test_user_varname.<locals>.test_implW  s|    A
Aq	Aq1uACAE]AA1Q4!AE(?*C ' # JrX   r|   r  c              3   8   K   | ]  }d |j                   v   yw)zslice(0, n, 1)N)r  )r  r  s     rV   r  z;TestParforsDiagnostics.test_user_varname.<locals>.<genexpr>h  s     R7Q! AII-7Qs   N)r   r   r  r7  anyfusion_reportsr  s       rV   test_user_varnamez(TestParforsDiagnostics.test_user_varnameT  sY    		 	

9&&y"5oo&:; 	R{7Q7QRR	TrX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |dddgi       y )Nc                      d} t        j                  | | f      }t        |       D ]  }t        |       D ]  }|dz  |z   |||f<    ! |S r  r  )r   r   r   rq  s       rV   r  z<TestParforsDiagnostics.test_nested_prange.<locals>.test_implk  sQ    A!Q AAYA"fqjAadG #  HrX   r|   r  r   r   )r  r  r  r  s       rV   test_nested_prangez)TestParforsDiagnostics.test_nested_prangej  sV    	 	

9&&y"5oo&:;145s8 	  	=rX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |dddgidg       y )	Nc                  ^    d} t        j                  |       }t        j                  |      }|S r  )r   r  rh  r  s      rV   r  zCTestParforsDiagnostics.test_function_replacement.<locals>.test_implz  s&    A
A		!AHrX   r|   r  r   r   r   )rh  r  )r  r  r  r  r  s       rV   test_function_replacementz0TestParforsDiagnostics.test_function_replacementy  s]    	 	

9&&y"5oo&:;1-.H0C/E 	  	GrX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |d       y )Nc                  n    d} t        j                  | dz         }d}t        |       D ]
  }|||   z  } |S rV  r   r  r   r   r   r  r   s       rV   r  z8TestParforsDiagnostics.test_reduction.<locals>.test_impl  s=    AAACAYqt JrX   r|   r  r   r  r  r  s       rV   r  z%TestParforsDiagnostics.test_reduction  I    	 	

9&&y"5oo&:;1=rX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |d       y )Nc                  n    d} t        j                  | dz         }d}t        |       D ]
  }|||   z
  } |S rV  r  r  s       rV   r  z>TestParforsDiagnostics.test_reduction_binop.<locals>.test_impl  s=    AAACAYAaDj JrX   r|   r  r   r  r  r  s       rV   test_reduction_binopz+TestParforsDiagnostics.test_reduction_binop  r  rX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |d       y )Nc                  >    d} t        j                  |       }d|d d  |S )Nr   rH  r  )r   r   s     rV   r  z6TestParforsDiagnostics.test_setitem.<locals>.test_impl  s"    A
AAaDHrX   r|   r  r   r  r  r  s       rV   test_setitemz#TestParforsDiagnostics.test_setitem  sI    	 	

9&&y"5oo&:;1=rX   c                     d }| j                  |       | j                  |d      }|j                  d   }| j                  |d       y )Nc                      d} d}d}t        |       D ]5  }t        j                  |f      }t        |      D ]  }|||<   	 ||d   z  }7 |S )Nr   r   r   rI   )r   r   r$  r   )r   r-  r  r   temprq  s         rV   r  zBTestParforsDiagnostics.test_allocation_hoisting.<locals>.test_impl  sY    AACAYxx~qADG "tBx	 
 JrX   r|   r  r   )r  r  r  s       rV   test_allocation_hoistingz/TestParforsDiagnostics.test_allocation_hoisting  sI    		 	

9&&y"5oo&:;CrX   )NNNNN)rw   rN   rx   r   r  r  r  r  r  r  r  r  r  r  r  r  r|   rX   rV   r  r    sS    M
 =A@DBF$:;>T,=G>>
>DrX   r  c                       e Zd Zd Zd Zy)TestPrangeBasec                    |j                   }t        |j                        }|Qd|j                  v sJ t        |j                  D cg c]  }|dk7  r|nd c}      }t	        |j
                        }n9|j                  j                  d      }g }t        j                  |      D ]I  }	|	j                  dk(  st        |	j                        |k(  s,|j                  |	j                  dz          K |j                  d       t        |      }t        |      dz
  }
t        j                   dv r	d|
dz  z   }
n,t        j                   dv rnt#        t        j                         t%        |j
                        }t        |      t        |      k  sJ |D ]  }||   }|
||<    t	        |      }|j'                  ||      }t)        j*                  |t-                     }|S c c}w )z
        This function does the actual code augmentation to enable the explicit
        testing of `prange` calls in place of `range`.
        r   r   LOAD_GLOBALr   ))r   r  )r   rc  ))r   ry  )r   r   )co_codeco_names)__code__r   r  r   bytesr  r  disBytecodeopnamerB   r  r   offsetr   rC   	PYVERSIONNotImplementedError	bytearrayreplacepytypesFunctionTypeglobals)rS   r   patch_instancepyfunc_codeprange_namesr   new_code	range_idxrange_locationsinstr
prange_idxr   r-  prange_codepfuncs                  rV   generate_prange_funcz#TestPrangeBase.generate_prange_func  s   
 ooK001! k22222 +6+?+?"A+?a ()G|!"A+?"A BL[001H $,,227;I Ok2<<=0+EII6)C'..u||a/?@ 3
 ) .L\*Q.J"44*/2
$55)%//:: !4!45H~&#o*>>>>#%a( * $ XH "))(3? * A $$[')<O"As   G!c                 \   |j                  dd      }|j                  dd      }|j                  dd      }| j                  ||      }t        |D cg c]  }t        j                  |       c}      }	| j                  ||	      }
t        j                  d      5 }t        j                  d       | j                  ||	      }ddd       |r| j                  ||	       |r | j                  ||	      }t        d	|ifi |} | j                  ||
g|i | S c c}w # 1 sw Y   ^xY w)
a
  
        The `prange` tester
        This is a hack. It basically switches out range calls for prange.
        It does this by copying the live code object of a function
        containing 'range' then copying the .co_names and mutating it so
        that 'range' is replaced with 'prange'. It then creates a new code
        object containing the mutation and instantiates a function to contain
        it. At this point three results are created:
        1. The result of calling the original python function.
        2. The result of calling a njit compiled version of the original
            python function.
        3. The result of calling a njit(parallel=True) version of the mutated
           function containing `prange`.
        The three results are then compared and the `prange` based function's
        llvm_ir is inspected to ensure the scheduler code is present.

        Arguments:
         pyfunc - the python function to test
         args - data arguments to pass to the pyfunc under test

        Keyword Arguments:
         patch_instance - iterable containing which instances of `range` to
                          replace. If not present all instance of `range` are
                          replaced.
         scheduler_type - 'signed', 'unsigned' or None, default is None.
                           Supply in cases where the presence of a specific
                           scheduler is to be asserted.
         check_fastmath - if True then a check will be performed to ensure the
                          IR contains instructions labelled with 'fast'
         check_fastmath_result - if True then a check will be performed to
                                 ensure the result of running with fastmath
                                 on matches that of the pyfunc
         Remaining kwargs are passed to np.testing.assert_almost_equal


        Example:
            def foo():
                acc = 0
                for x in range(5):
                    for y in range(10):
                        acc +=1
                return acc

            # calling as
            prange_tester(foo)
            # will test code equivalent to
            # def foo():
            #     acc = 0
            #     for x in prange(5): # <- changed
            #         for y in prange(10): # <- changed
            #             acc +=1
            #     return acc

            # calling as
            prange_tester(foo, patch_instance=[1])
            # will test code equivalent to
            # def foo():
            #     acc = 0
            #     for x in range(5): # <- outer loop (0) unchanged
            #         for y in prange(10): # <- inner loop (1) changed
            #             acc +=1
            #     return acc

        r  Nr   Fcheck_fastmath_resultTr  r  r   )r   r  r   r   r   r   r  r  r  r   rB  r   r  r   )rS   r   r   r   r  r   r	  r  r   r   r   r  r   
fastcpfuncs                 rV   prange_testerzTestPrangeBase.prange_tester  s*   B  $4d;$4e< &

+BE J))&.A d3dU\\!_d34!!&#. $$D1_!!(+**5#6F 2
   , !77sCJ+Z8CFCF$$$VUFLTLVL' 4 21s   D(D""D+N)rw   rN   rx   r  r  r|   rX   rV   r  r    s    4l\rX   r  c                      e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zd Zd Z ej&                  d      d        Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d  Z#d! Z$d" Z%d# Z&d$ Z'y%)&TestPrangeBasicz Tests Prange c                 2    d }| j                  |dd       y )Nc                  d    d} t        j                  |       }t        |       D ]
  }d|z  ||<    |S )Nr   r  r   r$  r   r  s      rV   r  z0TestPrangeBasic.test_prange01.<locals>.test_impl]  s4    AA1XQw! HrX   r   Tr   r   r  r  s     rV   test_prange01zTestPrangeBasic.test_prange01\  #    	 	9Z*. 	 	0rX   c                 2    d }| j                  |dd       y )Nc                  r    d} t        j                  | dz
        }t        d|       D ]  }d|z  ||dz
  <    |S )Nr   r   r  r  r  s      rV   r  z0TestPrangeBasic.test_prange02.<locals>.test_implg  s>    AQA1a[7!a% !HrX   r   Tr  r  r  s     rV   test_prange02zTestPrangeBasic.test_prange02f  r  rX   c                 2    d }| j                  |dd       y )Nc                  4    d} t        d      D ]  }| dz  } 	 | S Nr   r   r  r  r   s     rV   r  z0TestPrangeBasic.test_prange03.<locals>.test_implq  #    A2YQ HrX   r   Tr  r  r  s     rV   test_prange03zTestPrangeBasic.test_prange03p  #    	
 	9Z*. 	 	0rX   c                 2    d }| j                  |dd       y )Nc                  4    d} t        d      D ]  }| dz  } 	 | S )Nr   r   r   r  r  s     rV   r  z3TestPrangeBasic.test_prange03mul.<locals>.test_implz  s#    A2YQ HrX   r   Tr  r  r  s     rV   test_prange03mulz TestPrangeBasic.test_prange03muly  r  rX   c                 2    d }| j                  |dd       y )Nc                  4    d} t        d      D ]  }| dz  } 	 | S )Nr  r   r   r  r  s     rV   r  z3TestPrangeBasic.test_prange03sub.<locals>.test_impl  s#    A2YQ HrX   r   Tr  r  r  s     rV   test_prange03subz TestPrangeBasic.test_prange03sub  r  rX   c                 2    d }| j                  |dd       y )Nc                  4    d} t        d      D ]  }| dz  } 	 | S r  r  r  s     rV   r  z3TestPrangeBasic.test_prange03div.<locals>.test_impl  r  rX   r   Tr  r  r  s     rV   test_prange03divz TestPrangeBasic.test_prange03div  r  rX   c                 2    d }| j                  |dd       y )Nc                  x    d} d}t        j                  d      }t        d      D ]  }|| k(  r|||<   d||<    |S )Nr   r   r   r   r   r  r   r   r   ri  r   s       rV   r  z0TestPrangeBasic.test_prange04.<locals>.test_impl  sG    AAA1X6AaDAaD	 
 HrX   r   Tr  r  r  s     rV   test_prange04zTestPrangeBasic.test_prange04  s#    		 	9Z*. 	 	0rX   c                 2    d }| j                  |dd       y )Nc                      d} t        j                  | t         j                        }d}t        d| dz
  d      D ]
  }|||   z  } |S Nr   r
  r   r   r   r  r{  r   r   ri  r  r   s       rV   r  z0TestPrangeBasic.test_prange05.<locals>.test_impl  sI    A2::.AA1a!eQ'QqT	 (HrX   r   Tr  r  r  s     rV   test_prange05zTestPrangeBasic.test_prange05  #    	 	9Z*. 	 	0rX   c                 2    d }| j                  |dd       y )Nc                      d} t        j                  | t         j                        }d}t        ddd      D ]
  }|||   z  } |S r/  r0  r1  s       rV   r  z0TestPrangeBasic.test_prange06.<locals>.test_impl  sD    A2::.AA1a^QqT	 $HrX   r   Tr  r  r  s     rV   test_prange06zTestPrangeBasic.test_prange06  r3  rX   c                 2    d }| j                  |dd       y )Nc                      d} t        j                  | t         j                        }d}t        | d      D ]
  }|||   z  } |S r/  r0  r1  s       rV   r  z0TestPrangeBasic.test_prange07.<locals>.test_impl  sB    A2::.AA1a[QqT	 !HrX   r   Tr  r  r  s     rV   test_prange07zTestPrangeBasic.test_prange07  r3  rX   c                 2    d }| j                  |dd       y )Nc                      d} t        j                  |       }d}t        t        |            D ]#  }t        t        |            D ]
  }|||   z  } % |S r  r   r  r   r   r   ri  r  r   rq  s        rV   r  z0TestPrangeBasic.test_prange08.<locals>.test_impl  sQ    AAC3q6]s1vA1Q4KC ' # JrX   r   Tr  r  r  s     rV   test_prange08zTestPrangeBasic.test_prange08  #    	 	9Z*. 	 	0rX   c                 2    d }| j                  |dd       y )Nc                      d} t        j                  |       }d}t        d      D ]  }t        d      D ]
  }|||   z  }  |S r  r   r  r   r=  s        rV   r  z2TestPrangeBasic.test_prange08_1.<locals>.test_impl  sI    AAC1XqA1Q4KC "  JrX   r   Tr  r  r  s     rV   test_prange08_1zTestPrangeBasic.test_prange08_1  r?  rX   c                 6    d }| j                  |dgdd       y )Nc                  X    d} d}t        |       D ]  }t        |       D ]  }|dz  }	  |S Nr   r   r   r  )r   r  r   rq  s       rV   r  z0TestPrangeBasic.test_prange09.<locals>.test_impl  s8    AC1XqA1HC "  JrX   r   r   Tr  r   r   r  r  s     rV   test_prange09zTestPrangeBasic.test_prange09  s(    	 	9aS*4*. 	 	0rX   c                 6    d }| j                  |dgdd       y )Nc                  f    d} d}t        |       D ]  }d}t        |       D ]  }|dz  }	 ||z  }  |S rF  r  )r   acc2rq  acc1r   s        rV   r  z0TestPrangeBasic.test_prange10.<locals>.test_impl  sF    AD1XqAAID "	 
 KrX   r   r   TrG  r  r  s     rV   test_prange10zTestPrangeBasic.test_prange10  s(    	 	9aS*4*. 	 	0rX   z1list append is not thread-safe yet (#2391, #2408)c                 2    d }| j                  |dd       y )Nc                  h    d} t        |       D cg c]  }t        j                  |       c}S c c}w )Nr   )r   r   r  )r   rq  s     rV   r  z0TestPrangeBasic.test_prange11.<locals>.test_impl  s+    A',Qx0x!BFF1Ix000s   /r   Tr  r  r  s     rV   test_prange11zTestPrangeBasic.test_prange11  s#    	1 	9Z*. 	 	0rX   c                 2    d }| j                  |dd       y )Nc                  |    d} d}t        j                  |      }t        t        |             D ]
  }| ||   z  }  | S r  r<  )r  r   r^  r   s       rV   r  z0TestPrangeBasic.test_prange12.<locals>.test_impl   s?    CA
ACF7^qt $JrX   r   Tr  r  r  s     rV   test_prange12zTestPrangeBasic.test_prange12  s#    	 	9Z*. 	 	0rX   c                 Z    d }| j                  |t        j                  d      dd       y )Nc                 4    d}t        |       D ]  }|dz  }	 |S r  r  r  s      rV   r  z0TestPrangeBasic.test_prange13.<locals>.test_impl  s#    C1Xq JrX   r   r   Tr  )r  r   r   r  s     rV   test_prange13zTestPrangeBasic.test_prange13
  s-    	
 	9bhhqk**. 	 	0rX   c                 n    d }| j                  |t        j                  j                  d      dd       y )Nc                 R    d}t        t        |             D ]  }|| |   dz  z  } |S )Nr   r   r   r   )ri  r  r   s      rV   r  z0TestPrangeBasic.test_prange14.<locals>.test_impl  s/    A3q6]QqT!V #HrX   r   r   Tr  )r  r   rr  rs  r  s     rV   test_prange14zTestPrangeBasic.test_prange14  s3    	 	9biinnQ&7*4*. 	 	0rX   c                 4    d }| j                  |ddd       y )Nc                 d    d}t        |       D ]  }t        j                  d      }||d   z  }! |S )Nr   r  r  )r   r   r  )rn  r  r   r   s       rV   r  z0TestPrangeBasic.test_prange15.<locals>.test_impl#  s6    C1XGGFOqw  JrX   r  r   Tr  r  r  s     rV   test_prange15zTestPrangeBasic.test_prange15   s%    	 	9d:*. 	 	0rX   c                 4    d }| j                  |ddd       y )Nc                 8    d}t        |  |       D ]  }|dz  }	 |S r  r  rn  r  r   s      rV   r  z0TestPrangeBasic.test_prange16.<locals>.test_impl.  s'    CA2q\q "JrX   r  r   Tr  r  r  s     rV   test_prange16zTestPrangeBasic.test_prange16-  s%    	
 	9d8*. 	 	0rX   c                 4    d }| j                  |ddd       y )Nc                 h    d}t        j                  |       }t        |  |       D ]
  }|||   z  } |S r  rB  rn  r  r^  r   s       rV   r  z0TestPrangeBasic.test_prange17.<locals>.test_impl7  s8    C
AA2q\qt "JrX   ry  r   Tr  r  r  s     rV   test_prange17zTestPrangeBasic.test_prange176  %    	 	9a*. 	 	0rX   c                 4    d }| j                  |ddd       y )Nc                     d}t        j                  |       }t        |  d      D ]#  }|||   z  }t        d|       D ]
  }|||   z  } % |S )Nr   r   rB  )rn  r  r^  r   rq  s        rV   r  z0TestPrangeBasic.test_prange18.<locals>.test_implA  sW    C
AA2q\qtr1A1Q4KC & " JrX   ry  r   Tr  r  r  s     rV   test_prange18zTestPrangeBasic.test_prange18@  %    	 	9a*. 	 	0rX   c                 4    d }| j                  |ddd       y )Nc                     d}| dz   }t        j                  | |f      }t        |  |       D ]  }t        | |      D ]  }||||f   z  }   |S r  rB  )rn  r  Mr^  r   rq  s         rV   r  z0TestPrangeBasic.test_prange19.<locals>.test_implM  s]    CAAAAA2q\r1A1QT7NC & " JrX   ry  r   Tr  r  r  s     rV   test_prange19zTestPrangeBasic.test_prange19L  rk  rX   c                 4    d }| j                  |ddd       y )Nc                 f    d}t        j                  |       }t        d|       D ]
  }|||   z  } |S )Nr   rI   rB  rd  s       rV   r  z0TestPrangeBasic.test_prange20.<locals>.test_implY  s6    C
A2q\qt "JrX   ry  r   Tr  r  r  s     rV   test_prange20zTestPrangeBasic.test_prange20X  rf  rX   c                 4    d }| j                  |ddd       y )Nc                 6    d}t        dd      D ]  }|dz  }	 |S )Nr   rO  rI   r   r  r`  s      rV   r  z0TestPrangeBasic.test_prange21.<locals>.test_implc  s%    C2r]q #JrX   ry  r   Tr  r  r  s     rV   test_prange21zTestPrangeBasic.test_prange21b  s%    	
 	9a*. 	 	0rX   c                 4    d }| j                  |ddd       y )Nc                      d} d}t        j                  d      }t        dd      D ]  }|| k(  r|||<   |dk  rd||<   d||<    |S )	Nr   r   r   rG  r   r   rI   rH  r*  r+  s       rV   r  z0TestPrangeBasic.test_prange22.<locals>.test_impll  sY    AAA2q\6AaDUAaDAaD " HrX   r   Tr   r   r	  r  r  s     rV   test_prange22zTestPrangeBasic.test_prange22k  s&    	 	9X*.d 	 	LrX   c                 l    d }t        j                  d      d d d   }| j                  ||ddd       y )Nc                 B    t        t        |             D ]  }|| |<   	 | S rZ   rY  ri  r   s     rV   r  z0TestPrangeBasic.test_prange23.<locals>.test_impl}  s"    3q6]! #HrX       r   r   Trx  r   r$  r  rS   r  ri  s      rV   test_prange23zTestPrangeBasic.test_prange23{  s>    	 HHRL19a
*.d 	 	LrX   c                 l    d }t        j                  d      d d d   }| j                  ||ddd       y )Nc                 F    t        t        |        d      D ]  }|| |<   	 | S r  rY  r|  s     rV   r  z0TestPrangeBasic.test_prange24.<locals>.test_impl  s'    CF7A&! 'HrX   r}  r   r   Trx  r~  r  s      rV   test_prange24zTestPrangeBasic.test_prange24  s>    	 HHRL19a*.d 	 	LrX   c                 $   d }t        j                  d      }| j                  ||dgddd       | j                  |t	        j
                  |      f      }|j                  d   }|j                         }| j                  t        |      d       y )	Nc                     t        |       }t        |      D cg c]  }t        j                  |        }}t        |      D ]
  }| |z   ||<    |S c c}w rZ   )r   r   r   
zeros_like)ri  r   rJ   r  r   s        rV   r  z0TestPrangeBasic.test_prange25.<locals>.test_impl  sQ    AA-21X6X2==#XC61XQA J 7s   Ary  r   r   T)r  r   r   r	  r  r   )
r   r  r  r   r   r   r  r  r   r   )rS   r  ri  r   r  r  s         rV   test_prange25zTestPrangeBasic.test_prange25  s    	 GGEN9a!*4T15 	 	7 &&y5<<?2DEoo&:;$88:^,a0rX   c                 l    d }t        j                  d      d d d   }| j                  ||ddd       y )Nc                 R    | d d d   }t        t        |            D ]  }|||<   	 | S r^  rY  )ri  r  r   s      rV   r  z0TestPrangeBasic.test_prange26.<locals>.test_impl  s/    #A#A3q6]! #HrX   r}  r   r   Trx  r~  r  s      rV   test_prange26zTestPrangeBasic.test_prange26  s>    	
 HHRL19a
*.d 	 	LrX   c           	          d }| j                  |t        j                  d      t        j                  g d      ddgdd       y )	Nc                     t        |d   dz
        D ]0  }t        d      D ]   }t        j                  | |dz
  |dz          }" 2 yr   )r   r   abs)r   r   r  rq  r   r2  s         rV   r  z0TestPrangeBasic.test_prange27.<locals>.test_impl  sG    1Q46]qAq1QqSz*A " # rX   r'  )
r   r   r   r   r   r   r   r   r   r   r   r   r   TrG  )r  r   r  asarrayr  s     rV   test_prange27zTestPrangeBasic.test_prange27  sD    	 	999R=::&;<+,#*4*. 	 	0rX   c           	          d }t        j                  ddgddgddgddgddgddgg      }t        j                  ddgddgddgdd	gd	d
gg      }| j                  |||ddd       y )Nc                     t        j                  t        |            }t        dt        |            D ]/  }||df   }||df   }| |   }| |   }||z
  }|d   |d   z   }	|	||<   1 |S r  )r   r$  r   r   )
r   rQ  r  r-  i0r  Pt1Pt2r  vl2s
             rV   r  z0TestPrangeBasic.test_prange28.<locals>.test_impl  s    ((3q6"CQA'sAvYsAvYee#IdQqTkC ( JrX         rF  r  r   r   r   r   r   r   r   Trx  )r   re  r  r:  s       rV   test_prange28zTestPrangeBasic.test_prange28  s    
	 HHsCjRjRjCjRjRj" # HHq!f!f!f!f!f	  	9a:*.d 	 	LrX   c                 R    d }| j                  |d       | j                  |d       y )Nc                 f    d}| rt        d      D ]  }|dz  }	 |S t        d      D ]  }|dz  }	 |S )Nr   r   r   r  )r  r  r   s      rV   r  z0TestPrangeBasic.test_prange29.<locals>.test_impl  sF    FqAaKF "
 M qAaKF "MrX   TFr  r  s     rV   test_prange29zTestPrangeBasic.test_prange29  s)    	 	9d+9e,rX   c                     d }t        j                  t        j                  ddd            }t        j                  g d      }| j                  |||d       y )Nc                    |j                   d   }t        |       }t        j                  ||ft        j                        }t        |       |z   dz
  |z  }t        |      D ]#  }||z  }|dz   |z  }	| ||	 |d d  z  |d d ||	f<   % |S r6  )rd  r   r   r$  r{  r   )
r   par
numthreadsn_parn_xr  chunklenr   r  r  s
             rV   r  z0TestPrangeBasic.test_prange30.<locals>.test_impl  s    IIaLEa&CXXucl"**=FA+a/J>H:&HA)()%A(>q%*}% '
 MrX   r   r   rF  r#  r   )r   re  r  r  )rS   r  r   r  s       rV   test_prange30zTestPrangeBasic.test_prange30  sF    	 HHRYYq!S)*hh'9aa0rX   N)(rw   rN   rx   rC  r  r  r  r!  r$  r'  r,  r2  r6  r9  r>  rC  rH  rM  rW  skiprP  rS  rV  rZ  r]  ra  re  rj  ro  rr  ru  ry  r  r  r  r  r  r  r  r  r|   rX   rV   r  r  X  s    0000000	0	0	0
0
000 X]]FG0 H0	000
000
0
000L LL1"L0"L<-1rX   r  c                 
    | |fS rZ   r|   r   s     rV   test_call_hoisting_outcallr    s    q6MrX   c                       e Zd ZdZd Zd Zd Zd Zed        Z	d Z
d Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zed        Z y)TestPrangeSpecificz4 Tests specific features/problems found under prangec                 .    d }| j                  |d       y )Nc                 J    d}t        |       D ]  }|dz  }|dkD  s|dz  } |S Nr   r   r   r  r   r  r   s      rV   r  zRTestPrangeSpecific.test_prange_two_instances_same_reduction_var.<locals>.test_impl  5    A1XQr6FA  HrX   ry  r  r  s     rV   ,test_prange_two_instances_same_reduction_varz?TestPrangeSpecific.test_prange_two_instances_same_reduction_var  s    	 	9a(rX   c                     d }| j                  t        j                        5 }| j                  |d       d d d        d}| j	                  |t        j                               y # 1 sw Y   1xY w)Nc                 J    d}t        |       D ]  }|dz  }|dkD  s|dz  } |S r  r  r  s      rV   r  zKTestPrangeSpecific.test_prange_conflicting_reduction_ops.<locals>.test_impl  r  rX   ry  zBReduction variable c has multiple conflicting reduction operators.)r  r   UnsupportedErrorr  r   r  r  rS   r  r  r   s       rV   %test_prange_conflicting_reduction_opsz8TestPrangeSpecific.test_prange_conflicting_reduction_ops  s]    	 v6676y!, 8c3v//01	 87   A&&A/c                 ,    d }| j                  |       y )Nc                      dx} }t        d      D ]-  }|dk(  r| dz  } t        j                  d      }|d   s)|dz  }/ | |fS )Nr   r   r   r  r  r  )ri  r  r   r   s       rV   r  zLTestPrangeSpecific.test_prange_two_conditional_reductions.<locals>.test_impl"  sR    IA1X6FA(AwQ  a4KrX   r  r  s     rV   &test_prange_two_conditional_reductionsz9TestPrangeSpecific.test_prange_two_conditional_reductions   s    		 	9%rX   c                 ,    d }| j                  |       y )Nc                  `    d} t        d      D ]  }t        d      D ]  }|dk(  s	| dz  }   | S r  r  )ri  r   r   s      rV   r  zCTestPrangeSpecific.test_prange_nested_reduction1.<locals>.test_impl/  s:    A1XqAAvQ "  HrX   r  r  s     rV   test_prange_nested_reduction1z0TestPrangeSpecific.test_prange_nested_reduction1.  s    	 	9%rX   c                    d }| j                  t              5 } |        d d d        | j                  |d       }| j                  |d      }| j	                  |d      }| j                  t              5 }|j                          d d d        |j                         }| j                  |d   t        j                         y # 1 sw Y   xY w# 1 sw Y   IxY w)Nc                  d    d} t        j                  |       }t        |       D ]
  }d|z  ||<    |S )Nr}  r   r  r  s      rV   r  z<TestPrangeSpecific.test_check_error_model.<locals>.test_impl:  s4    AA1X1u! HrX   r|   r   )	r  ZeroDivisionErrorr  r   r   r   r   r   r  )rS   r  r  r  pcrespfcresr  s          rV   test_check_error_modelz)TestPrangeSpecific.test_check_error_model8  s    	 01VK 2 )))T:%%eR0//r: 01V 2 ##%BFF+ 21 21s   C4CC
Cc                    d }t        j                  d      j                  dd      }| j                  ||ddd       | j	                  |d       }t        t        j                  |      g      }| j                  ||      }| j                  |      }|j                         D ]F  \  }}|j                         D ].  }	d|	v s||	v s| j                  |	j                  d	      d
        F H y )Nc                 L    t        t        |             D ]  }| |   }d|d d   | S r  rY  )ri  r   r  s      rV   r  z?TestPrangeSpecific.test_check_alias_analysis.<locals>.test_implS  s-    3q6]aD! # HrX   r}  r   rW  r   Trx  definenoaliasr   )r   r$  r   r  r  r   r   r   r   r  r?  r(  r   r;  )
rS   r  ri  r  r   r   r@  r   r  r  s
             rV   test_check_alias_analysisz,TestPrangeSpecific.test_check_alias_analysisQ  s    	
 HHRL  A&9a
*.d 	 	L)))T:U\\!_%&--eS9!!$'IIKDAqt#T	 $$TZZ	%:A> '  rX   c                     d }| j                  t        j                        5 }| j                  |d       d d d        d}| j	                  |t        j                               y # 1 sw Y   1xY w)Nc                 8    d}t        d| d      D ]  }|dz  }	 |S r  r  r`  s      rV   r  zJTestPrangeSpecific.test_prange_raises_invalid_step_size.<locals>.test_implj  s'    C1a^q $JrX   r  z4Only constant step size of 1 is supported for prange)r  r   rB  r  r   r  r  r  s       rV   $test_prange_raises_invalid_step_sizez7TestPrangeSpecific.test_prange_raises_invalid_step_sizei  s[    	 v==>&y$/ ?Dc3v//01 ?>r  c           	      d   d }| j                  |dd       | j                  |d       }| j                  |d      }| j                  |      }d}d}t	        j
                  |||fz        }t	        j
                  d|d	|d
|      }d}	 |j                         D ]  \  }
}|
|j                  j                         v s#|j                         }t        |      D ]@  \  }}|j                  |      s| j                  |j                  ||dz                   d}	   | j                  |	d       y )Nc                  >    d} d}t        |       D ]
  }||dz  z  } |S )Nr  r   r  r  r  s      rV   r  zFTestPrangeSpecific.test_prange_fastmath_check_works.<locals>.test_imply  s,    AA1XQW HrX   r   Tr  r|   z%[A-Z_0-9]?(.[0-9]+)+[.]?[i]?z)\s+%s = fmul fast double %s, 5.000000e-01z\s+z = fadd fast double z, Fr   z'fast instruction pattern was not found.)r  r  r   r  r)  r  r?  r   r   r(  r  r=  r7  )rS   r  r  r   r   _id
recipr_strreciprocal_inst	fadd_instfoundr  kernelr+  r   r   s                  rV    test_prange_fastmath_check_worksz3TestPrangeSpecific.test_prange_fastmath_check_worksu  s)   	 	9Z*. 	 	0)))T:--eR8  &-A
**Z3*%<=JJ"%sC 1 2	
 $BHHJLD&t||0022!,,.%h/DAq&,,Q/	Q(HI $	 0	 ' 	HIrX   c                 .    d }| j                  |d       y )Nc                     t        j                  | | f      }|d   }t        |       D ]
  }|dz   ||<    |j                         S r  r   r$  r   rg  )r   r   r   rq  s       rV   r  z8TestPrangeSpecific.test_parfor_alias1.<locals>.test_impl  sC    !Q A!A1X1u! 557NrX   r   r  r  s     rV   test_parfor_alias1z%TestPrangeSpecific.test_parfor_alias1  s    	 	9a(rX   c                 .    d }| j                  |d       y )Nc                     t        j                  | | f      }t        |       D ]  }||   }t        |       D ]
  }||z   ||<    ! |j                         S rZ   r  )r   r   r   r   rq  s        rV   r  z8TestPrangeSpecific.test_parfor_alias2.<locals>.test_impl  sS    !Q A1XA$aQx!1u!    557NrX   r   r  r  s     rV   test_parfor_alias2z%TestPrangeSpecific.test_parfor_alias2  s    	 	9a(rX   c                 .    d }| j                  |d       y )Nc                     t        j                  | | | f      }t        |       D ]7  }||   }t        |       D ]"  }||   }t        |       D ]  }||z   |z   ||<    $ 9 |j                         S rZ   r  )r   r   r   r   rq  r  r   s          rV   r  z8TestPrangeSpecific.test_parfor_alias3.<locals>.test_impl  sp    !Q#A1XA$aQx!aDqAQ!A$ "    557NrX   r   r  r  s     rV   test_parfor_alias3z%TestPrangeSpecific.test_parfor_alias3  s    	 	9a(rX   c                     d }| j                  |dd      }|d   }d}| j                  |t        |j                               y )Nc                 *    t        |      D ]  }| } S rZ   r  )r   rQ  rq  r   s       rV   r  z8TestPrangeSpecific.test_parfor_race_1.<locals>.test_impl  s    1X HrX   r   r'  r   zVariable k used in parallel loop may be written to simultaneously by multiple workers and may result in non-deterministic or unintended results.)r  r   r  r  )rS   r  r  warning_objexpected_msgs        rV   test_parfor_race_1z%TestPrangeSpecific.test_parfor_race_1  sJ    	 ,,YB?%a(F 	lC(;(;$<=rX   c                 ,    d }| j                  |       y)a   issue 3686: if a prange has something inside it that causes
            a nested parfor to be generated and both the inner and outer
            parfor use the same call variable defined outside the parfors
            then ensure that when that call variable is pushed into the
            parfor that the call variable isn't duplicated with the same
            name resulting in a redundant type lock.
        c                     d} t         j                  }t        d      D ]+  } |d      }|  |t        j                  d            d   z  } - t        d      D ]+  } |d      }|  |t        j                  d            d   z  } - | S )Nr   r   rF  r   )r   negativer   r$  )r  r  r   this_matterss       rV   r  zGTestPrangeSpecific.test_nested_parfor_push_call_vars.<locals>.test_impl  s}    AA1X uQrxx|_Q''  1X uQrxx|_Q''  HrX   Nr  r  s     rV   !test_nested_parfor_push_call_varsz4TestPrangeSpecific.test_nested_parfor_push_call_vars  s    
	 	9%rX   c                     d }d}t        j                  |||f      }t        j                  |t         j                        }| j                  |||dg       y)a+   issue4903: a global is copied next to a parfor so that
            it can be inlined into the parfor and thus not have to be
            passed to the parfor (i.e., an unsupported function type).
            This global needs to be renamed in the block into which
            it is copied.
        c                 `   t        j                  t        |            }t        j                  t        |            }t        d      D ]a  }||   }t        |      D ]  }|t        j                  | ||f         z  }! t        |      D ]  }|t        j                  | ||f         z  }! c ||fS r  )r   r$  r   r   rI  )zztclhlcr   ntr  s          rV   r  zATestPrangeSpecific.test_copy_global_for_parfor.<locals>.test_impl  s    #b'"B#b'"B1XUrA"&&AqD**B #rA"&&AqD**B #	  r6MrX   r   r
  r   r  N)r   r  r  r  )rS   r  r-  r  r  s        rV   test_copy_global_for_parforz.TestPrangeSpecific.test_copy_global_for_parfor  sO    		 WWaAYWWQbgg&9b"aSArX   c                 .    d }| j                  |d       y )Nc                 p    d}t         j                  }t        d      D ]  } |d      }| ||       z  } |S )Nr   r   rF  )r   r  r   )r   r  r  r   r  s        rV   r  zGTestPrangeSpecific.test_multiple_call_getattr_object.<locals>.test_impl  s;    AA1X vQqT	  HrX   rF  r  r  s     rV   !test_multiple_call_getattr_objectz4TestPrangeSpecific.test_multiple_call_getattr_object  s    	 	9c*rX   c                 |   d }t        j                  ddt        fdt        fg      }t        j                  ddt        fdt        fg      }t        j                  ddt        fdt        fg      }|j	                  t         j
                        }|j	                  t         j
                        }|j	                  t         j
                        }t         ||            }t         t        |      |            }	t        |d      }
t         |
|            }| j                  ||	       | j                  ||       y )Nc                 V    t        t        |             D ]  }d| j                  |<    | S r  )r   r   r   )r   r   s     rV   r  zHTestPrangeSpecific.test_argument_alias_recarray_field.<locals>.test_impl  s&    3q6]A #HrX   r   r   rQ  r
  Tr   )	r   r$  r  r  viewrecarrayr   r   r   )rS   r  X1X2X3r,  r-  v3
python_resnjit_respa_funcpa_ress               rV   "test_argument_alias_recarray_fieldz5TestPrangeSpecific.test_argument_alias_recarray_field  s    	 XXb#uSz <=XXb#uSz <=XXb#uSz <=WWR[[!WWR[[!WWR[[! )B-(
Y+,y40gbk"X.V,rX   c                     t         d        fd} |d      } t        |      d      }t        |d      } |d      }| j                  ||       | j                  ||       y)z issue3699: test that mutable variable to call in loop
            is not hoisted.  The call in test_impl forces a manual
            check here rather than using prange_tester.
        c                 B    | d   }| d   dz   }| j                  |       |S )z If the variable X is hoisted in the test_impl prange
                then subsequent list_check calls would return increasing
                values.
            rI   r   )r   )r^  r  r   s      rV   
list_checkz>TestPrangeSpecific.test_mutable_list_param.<locals>.list_check  s*     B%C"	AHHQKJrX   c                 >    t        |       D ]  }dg} |      } S r  r  )r   r   r^  r   r   s       rV   r  z=TestPrangeSpecific.test_mutable_list_param.<locals>.test_impl   s(    AYEqM  HrX   r   Tr   Nr   r   )rS   r  r  r  r  r  r   s         @rV   test_mutable_list_paramz*TestPrangeSpecific.test_mutable_list_param  sl    
 
	 
		
 r]
"4	?2&y40X.V,rX   c                     d }t        j                  g dt              t        j                  ddgt              g}| j                  ||       y )Nc           	          t        j                  t        t        |             D cg c]  }t        | |          c}      S c c}w rZ   )r   re  r   r   )r   r   s     rV   r  zDTestPrangeSpecific.test_list_comprehension_prange.<locals>.test_impl.  s3    88c!f>1S1Y>??>s   A)r   r   r   r
  r   r   )r   re  r  r  r  s      rV   test_list_comprehension_prangez1TestPrangeSpecific.test_list_comprehension_prange,  s<    	@XXgS)"((Aa5*DE9a(rX   c                 |    d }t        j                  dt         j                        }| j                  ||dd       y )Nc                     t        j                  | j                        }t        | j                  d         D ]#  }| |   d   dz  }|dk(  rd}|dk(  rd}||g||<   % |S )Nr   g     o@)r   r$  rd  r   )imager   r   r  r   r  hs          rV   r  z>TestPrangeSpecific.test_ssa_false_reduction.<locals>.test_impl9  sk    HHU[[)E5;;q>*!HQK%'6A6Aq!9a + LrX   rL  r
  r   )r   r$  r   r  )rS   r  r	  s      rV   test_ssa_false_reductionz+TestPrangeSpecific.test_ssa_false_reduction3  s1    		 rxx09eQ2rX   c                 ,    d }| j                  |       y )Nc                      d} t        j                  | t         j                        }t        d      D ]  }dg}d|d<   |d   ||<    |S )Nr   r
  r   r   )r   r  rv  r   )r   r   r   r^  s       rV   r  z@TestPrangeSpecific.test_list_setitem_hoisting.<locals>.test_implJ  sM    A"((+A1XC!t!  HrX   r  r  s     rV   test_list_setitem_hoistingz-TestPrangeSpecific.test_list_setitem_hoistingG  s    	 	9%rX   c           
          d }t         j                  dz   }| j                  |t        |      D cg c]5  }t	        j
                  t        j                  t        j                        7 c}dg       y c c}w )Nc                 t   t        t        |             D cg c]J  }t        j                  t        j
                  t        j                        t        j                  d      fL }}t        t        |             D ]+  }| |   }t        j                  d      }||d<   | |   |f||<   - |d   d   d   S c c}w Nkey_type
value_typer   r   )	r   r   r   r  r   rv  r{  r   r$  inputsrJ   outputsr   rQ  r  s         rV   r  z9TestPrangeSpecific.test_tuple_hoisting.<locals>.test_implW  s    jopstzp{j|}j|ef

EKKEMMRTVT\T\]^T_`j|G}3v;'1IhhqkA$Qi-
	 (
 1:a=## ~s   AB5r   r  r  	r   r  r  r   r   r  r   rv  r{  rS   r  rn  r   s       rV   test_tuple_hoistingz&TestPrangeSpecific.test_tuple_hoistingU  o    	$ $$q(9kpqrks&tksfgtzz5;;SXS`S`'aks&t  GH  FI  	J&t   :A5
c           
          d }t         j                  dz   }| j                  |t        |      D cg c]5  }t	        j
                  t        j                  t        j                        7 c}dg       y c c}w )Nc                    t        t        |             D cg c]J  }t        j                  t        j
                  t        j                        t        j                  d      fL }}t        t        |             D ]3  }| |   }t        j                  d      }||d<   t        | |   |      ||<   5 |d   d   d   S c c}w r  )
r   r   r   r  r   rv  r{  r   r$  r  r  s         rV   r  z8TestPrangeSpecific.test_call_hoisting.<locals>.test_imple  s    jopstzp{j|}j|ef

EKKEMMRTVT\T\]^T_`j|G}3v;'1IhhqkA7q	3G
	 (
 1:a=## ~s   AB=r   r  r  r  r  s       rV   test_call_hoistingz%TestPrangeSpecific.test_call_hoistingc  r  r  c                     t        j                  dt         j                  fg      }d }d }| j                  |t        j                  d|      |g       y )Nr  c                 4    t        d      D ]
  }d| |   d<    y )Nr   r  r  )statesr   s     rV   r  z?TestPrangeSpecific.test_record_array_setitem.<locals>.test_implu  s    1X#$q	%  rX   c                 *    | d   d   |d   d   k(  sJ y )Nr   r  r|   r   s     rV   ri  z>TestPrangeSpecific.test_record_array_setitem.<locals>.comparery  s     Q4;!A$u+-.-rX   r   )rd  r  rk  )r   r  r   r  r$  )rS   state_dtyper  ri  s       rV   test_record_array_setitemz,TestPrangeSpecific.test_record_array_setitemq  sP    hh 123	%	/ 	988!;?/7j 	 	:rX   c                     t        j                  dt         j                  fg      }d }t        j                  d|      }d }| j	                  |||g       y )Nr   c                 h    | j                   }t        | j                         D ]  }d|z   | d   |<    | S )NrH  r   )r  r   )r"  r   r   s      rV   r  zKTestPrangeSpecific.test_record_array_setitem_yield_array.<locals>.test_impl  s4    A6;;'!"QsA (MrX   r   r
  c                 D    t         j                  j                  | |       y rZ   rg  r   s     rV   ri  zJTestPrangeSpecific.test_record_array_setitem_yield_array.<locals>.comparer  rj  rX   rk  )r   r  rw  r$  r  )rS   r$  r  r"  ri  s        rV   %test_record_array_setitem_yield_arrayz8TestPrangeSpecific.test_record_array_setitem_yield_array  sV    hhbgg/0	 "K0	* 	9!/7j 	 	:rX   c                 0    d }| j                  |dd       y )Nc                     t        j                  | f      }|dk(  r"t        |       D ]  }||xx   dz  cc<    |d   S t        |       D ]  }||xx   dz  cc<    |d   S )Nr   r   r   r  )r  caser  r   s       rV   r  z4TestPrangeSpecific.test_issue7501.<locals>.test_impl  sg    XXtg&FqytA1INI %
 !9 tA1INI %!9rX   r   r   r  r  s     rV   test_issue7501z!TestPrangeSpecific.test_issue7501  s    	 	9a+rX   c                 p    d }d}t         j                  j                  |      }| j                  ||       y )Nc                    d}t        j                  g d      }|j                  d   }| j                  d   }d}t        |      D ]  }| |   }||z
  dz   d|dz  z  z  }t        j                  |      }	||	t        j
                  ||z        z
  t        j
                  t        j                  t        j                  ||	z
                    z   z  } |S )NrE  )r  r  r5  r   r   )r   re  rd  r   r  rG  rg  rI  )
r^  r   pointsrn  r   expsr   pr  r-  s
             rV   r  z6TestPrangeSpecific.test_kde_example.<locals>.test_impl  s    AXX./FQA
AD1XaD6zAo%!ad(3FF1IBFF1q5M)BFF266"&&Q-3H,III	 
 KrX   r  )r   rr  rs  r  )rS   r  r   r^  s       rV   test_kde_examplez#TestPrangeSpecific.test_kde_example  s0    	 IINN19a(rX   c                 X    d }t        j                  d      }| j                  ||       y )Nc                     t        j                  |       }t        j                  |       }t        t	        |             D ]  }|j                         ||<    |S rZ   )r   r  r  r   r   rg  )r   ri  r  r   s       rV   r  z4TestPrangeSpecific.test_issue7578.<locals>.test_impl  sE    a A&&)C3q6]wwy! # HrX   r7  )r   r  r  r  s      rV   test_issue7578z!TestPrangeSpecific.test_issue7578  s&    	 IIcN9a(rX   N)!rw   rN   rx   rC  r  r  r  r  r=   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r%  r)  r-  r3  r9   r6  r|   rX   rV   r  r    s    >	)2&& , ,00
2"JH))
)
>&*B.	+-,-6)3(&JJ::$,)& ) )rX   r  c                   V    e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Zy)TestParforChunksizingz:
    Tests chunksize handling in ParallelAccelerator.
    Fc                     t        d       y r  r   r\   s    rV   setUpzTestParforChunksizing.setUp  
    q!rX   c                     t        d       y r  r:  r\   s    rV   tearDownzTestParforChunksizing.tearDown  r<  rX   c                     | j                  t               d       t        d       | j                  t               d       t        d       | j                  t               d       y Nr   rW  )r   r   r   r\   s    rV   $test_python_parallel_chunksize_basicz:TestParforChunksizing.test_python_parallel_chunksize_basic  sN    /115q!/115q!/115rX   c                     | j                  t               d       t        d      5  | j                  t               d       d d d        | j                  t               d       y # 1 sw Y   $xY wr@  )r   r   r   r\   s    rV   test_python_with_chunksizez0TestParforChunksizing.test_python_with_chunksize  sT    /115"35q9 #/115 #"s   A$$A-c                     t         d        }t         d        }| j                   |       d        |d       | j                   |       d        |d       | j                   |       d       y )Nc                      t               S rZ   )r   r|   rX   rV   get_cszHTestParforChunksizing.test_njit_parallel_chunksize_basic.<locals>.get_cs  s    )++rX   c                     t        |       S rZ   r:  r!  s    rV   set_cszHTestParforChunksizing.test_njit_parallel_chunksize_basic.<locals>.set_cs  s    )!,,rX   r   rW  r  )rS   rF  rH  s      rV   "test_njit_parallel_chunksize_basicz8TestParforChunksizing.test_njit_parallel_chunksize_basic  sn    		, 
	, 
	- 
	- 	1%q	1%q	1%rX   c                     t         d        } |d      \  }}}| j                  |d       | j                  |d       | j                  |d       y )Nc                     t               }t        d      5  t               }d d d        t               }||fS # 1 sw Y   xY w)NrW  )r   r   )r   cs1cs2cs3s       rV   r  zATestParforChunksizing.test_njit_with_chunksize.<locals>.test_impl  s<    (*C#A&,. '(*CS=  '&s	   8ArW  r   r  )rS   r  rL  rM  rN  s        rV   test_njit_with_chunksizez.TestParforChunksizing.test_njit_with_chunksize  sU    		! 
	! "!S#a a a rX   c                    t        d      d        }dD ]o  }t        d      D ]_  } ||dz   |      \  }}| j                  t        j                  |dk(               | j                  t        j                  |dk(               a q y	)
z Test that all the iterations get run if you set the
            chunksize.  Also check that the chunksize that each
            worker thread sees has been reset to 0. Tr   c                 (   t        j                  |      }t        j                  |d      }t        j                  |       5  t        j
                  |      D ]  }t        j                         ||<   d||<     	 d d d        ||fS # 1 sw Y   ||fS xY w)Nir  )r   r$  r7  r   r   r   r   )csr   r  inner_csr   s        rV   r  zLTestParforChunksizing.test_all_iterations_reset_chunksize.<locals>.test_impl  s|    ((1+Cwwq#H))"-aA"'">">"@HQKCF ) . = 	 . = s   7BB)i  i  i  i  rP  r   r  r   N)r   r   r7  r   all)rS   r  rq  r   r  rS  s         rV   #test_all_iterations_reset_chunksizez9TestParforChunksizing.test_all_iterations_reset_chunksize  s{    
 
t		! 
	! 'A2Y )!A#q 1Xsby 12x1} 56  'rX   c                     | j                  t              5 }t        d        } |        d d d        d}| j                  |t	        j
                               y # 1 sw Y   1xY w)Nc                      t        d       y )NrI   r:  r|   rX   rV   neg_testzMTestParforChunksizing.test_njit_parallel_chunksize_negative.<locals>.neg_test  s
    &r*rX   /chunksize must be greater than or equal to zero)r  r   r   r   r  r  )rS   rC  rX  r   s       rV   %test_njit_parallel_chunksize_negativez;TestParforChunksizing.test_njit_parallel_chunksize_negative  sZ    z*f+ + J + @c3v//01 +*s   AA#c                     | j                  t              5 }t        d       d d d        d}| j                  |t	        j
                               y # 1 sw Y   1xY w)NrI   rY  )r  r   r   r   r  r  rS   rC  r   s      rV   'test_python_parallel_chunksize_negativez=TestParforChunksizing.test_python_parallel_chunksize_negative   sI    z*f"2& + @c3v//01	 +*   AAc                     | j                  t        j                        5 }t        d        } |        d d d        d}| j	                  |t        j                               y # 1 sw Y   1xY w)Nc                      t        d       y )Ninvalid_typer:  r|   rX   rV   r   zMTestParforChunksizing.test_njit_parallel_chunksize_invalid_type.<locals>.impl*  s
    &~6rX   )The parallel chunksize must be an integer)r  r   TypingErrorr   r   r  r  )rS   rC  r   r   s       rV   )test_njit_parallel_chunksize_invalid_typez?TestParforChunksizing.test_njit_parallel_chunksize_invalid_type(  s_    v112f7 7 F 3 :c3v//01 32s   A$$A-c                     | j                  t              5 }t        d       d d d        d}| j                  |t	        j
                               y # 1 sw Y   1xY w)Nra  rb  )r  	TypeErrorr   r   r  r  r\  s      rV   +test_python_parallel_chunksize_invalid_typezATestParforChunksizing.test_python_parallel_chunksize_invalid_type3  sH    y)V">2 * :c3v//01	 *)r^  N)rw   rN   rx   rC  ry   r;  r>  rA  rC  rI  rO  rU  rZ  r]  rd  rg  r|   rX   rV   r8  r8    sF     """66& ! 70
22	22rX   r8  c                       e Zd ZdZd Zeej                  d               Ze ej                  ddi      d               Z	e ej                  ddi      d               Z
y	)
TestParforsVectorizerFc           
         |j                  dd      }|j                  dd      }|j                  dd      }|j                  dd      }||d	}	g }
|	j                         D ]   \  }}|
j                  t        ||             " |
d
   5  |
d   5  t	        |D cg c]  }t        j                  |       c}      }| j                  |d       }|dk(  r| j                  ||      }n| j                  ||      }| j                  |      }|rt        j                  d      }|j                  |j                  j                               }| j!                  t#        |      d       | j%                  |d
   |       | j'                  |i        |cd d d        cd d d        S c c}w # 1 sw Y   nxY wd d d        y # 1 sw Y   y xY w)Nr   Fcpu_namezskylake-avx512
assertionsTcpu_featuresz-prefer-256-bit)NUMBA_CPU_NAMENUMBA_CPU_FEATURESr   r   z%call\s+\w+\*\s+@do_scheduling_(\w+)\()r   r?  r   r6   r   r   r   r  r   r   r%  r)  r  findallr   r   r   r   r   assertNotEqual)rS   r   schedule_typer   r   r   rk  rl  rm  env_opts	overridesr   r  r   r   pfunc_vectorizabler   asmschedtymatchess                       rV   get_gufunc_asmz$TestParforsVectorizer.get_gufunc_asmB  s   ::j%0::j*:;ZZd3
 zz.2CD&.*6 	NN$DAq0A67 % q\9Q<$7$Qa$78C!%!:!:4!F4556H#N,,-?E &&t,C**%MN!//$,,*C*C*EF''Ga8  ];##C,% (<\\7 (<\\\s7   F8
F#F4CF#	F8F##F,	(F88Gc                 $   d }t        j                  d      }| j                  |d|d      }| j                  |d|d      }|j                         D ]A  }| j	                  d|v        | j	                  d|v xs d	|v        | j	                  d
|v        C |j                         D ]g  }| j	                  d|v       | j	                  d|v       | j	                  d|v xr d	|v       | j	                  d|v        | j	                  d
|v       i y) This checks that if fastmath is set and the underlying hardware
        is suitable, and the function supplied is amenable to fastmath based
        vectorization, that the vectorizer actually runs.
        c                 p    t        |       }d}t        |      D ]  }|t        j                  |      z  } |S r  r   r   r   rH  )ri  r   r  r   s       rV   will_vectorizezJTestParforsVectorizer.test_vectorizer_fastmath_asm.<locals>.will_vectorizer  s5    AAC1Xrwwqz! JrX   r   r   Tr   Fvaddpdvsqrtpd__svml_sqrtzmmvsqrtsdvaddsdN)r   r$  ry  r  r7  )rS   r~  r  fast_asmslow_asmr  s         rV   test_vectorizer_fastmath_asmz2TestParforsVectorizer.test_vectorizer_fastmath_asmg  s   	 hhrl&&~z304 ' 6&&~z305 ' 7"A OOHM*OOIN@mq.@AOOEQJ' # "AOOHA-.OOIQ./OOINE}A/EFOOHM*OOEN+ #rX   NUMBA_BOUNDSCHECK0)envvarsc                    d }d }t        j                  d      }| j                  t        j                         | j                  |d|d      }| j                  |d|d      }|j                         D ];  }| j                  d|v       | j                  d	|v        | j                  d
|v       = |j                         D ]A  }| j                  d|v xs d|v        | j                  d|v        | j                  d
|v        C y)r{  c                 v    t        |       }t        | d      D ]  }t        j                  | |         | |<    | S r  r}  ri  r   r   s      rV   will_not_vectorizezTTestParforsVectorizer.test_unsigned_refusal_to_vectorize.<locals>.will_not_vectorize  s7    AAA2q\wwqt}! "HrX   c                 r    t        |       }t        |      D ]  }t        j                  | |         | |<    | S rZ   r}  r  s      rV   r~  zPTestParforsVectorizer.test_unsigned_refusal_to_vectorize.<locals>.will_vectorize  s3    AA1Xwwqt}! HrX   r   r   Tr  r   r  r  r  r  vmovupdN)r   r$  r  r   BOUNDSCHECKry  r  r7  )rS   r  r~  r  	novec_asmvec_asmr  s          rV   "test_unsigned_refusal_to_vectorizez8TestParforsVectorizer.test_unsigned_refusal_to_vectorize  s   		 hhrl 	++,''(:Hc15 ( 7	 %%nj#15 & 7 !!#AOOIQ./OOIN+OOEN+ $ !A OOIN@mq.@AOOIN+OOEQJ' "rX   c                 <   d }d }| j                  t        j                         | j                  |dd      }| j                  |dd      }d }|j	                         D ]  \  }} ||      } n |j	                         D ]  \  }} ||      }	 n dd	lm}
 | j                  t              t        	             t        ||	      D ]Q  \  }}||k(  r |
d
 ||      }|j                         }|D ]&  }|d   dk(  s| j                  ||d   |d    d       ( S y)z This checks vectorization for signed vs unsigned variants of a
        trivial accumulator, the only meaningful difference should be the
        presence of signed vs. unsigned unpack instructions (for the
        induction var).
        c                  <    d} d}t        |  d      D ]  }||z  }	 |S )N   r  r   r  r  s      rV   signed_variantzMTestParforsVectorizer.test_signed_vs_unsigned_vec_asm.<locals>.signed_variant  s,    AAA2q\Q "HrX   c                  8    d} d}t        |       D ]  }||z  }	 |S )Nr  r  r  r  s      rV   unsigned_variantzOTestParforsVectorizer.test_signed_vs_unsigned_vec_asm.<locals>.unsigned_variant  s(    AA1XQ HrX   r   Tr  r   c                 "   g }| j                         D ]y  }|j                         }|dk7  s|j                  d      r+|j                  d      r=|j                  d      rOd|v rT|j                  t	        j
                  dd|             { |S )N rH   rJ   "r  z[	])r(  strip
startswithr   r)  sub)rv  r  r   spds       rV   strip_instrszKTestParforsVectorizer.test_signed_vs_unsigned_vec_asm.<locals>.strip_instrs  sw    C^^%ggi "9cnnS&9(+s(;(+s(;(?3(F

266&"c#:; & JrX   r   )SequenceMatcherc                     | dk(  S )N	r|   r!  s    rV   r  zGTestParforsVectorizer.test_signed_vs_unsigned_vec_asm.<locals>.<lambda>  s    drX   insertrG  rI   r  N)r  r   r  ry  r?  difflibr  r   r   r   get_opcodes)rS   r  r  
signed_asmunsigned_asmr  r   r  signed_instrunsigned_instrsmr   r   r  r9  r<  s                   rV   test_signed_vs_unsigned_vec_asmz5TestParforsVectorizer.test_signed_vs_unsigned_vec_asm  s9   		 	++,((59 ) ;
**+;Z59 + ;	 $$&DAq'?L ' !&&(DAq)!_N ) 	2 	\*C,?@n5DAqAv*Aq1mmoB!u(((2b6"R&)93?  6rX   N)rw   rN   rx   ry   ry  r7   r3   run_test_in_subprocessr  r  r  r|   rX   rV   ri  ri  ;  s    
 "#J $$%, % %,N $X$$.A3-GH)( I )(V  %X$$.A3-GH=@ I =@rX   ri  c                   "    e Zd ZdZd Zd Zd Zy) TestParforReductionSetNumThreadszCTest execution correctness on reductions with set_num_threads.
    c                     t         j                  }d|z  |dz
  t        d      fd       }|j                        } |      }| j	                  ||       y )Nr   r   Tr   c                     d}t        |        t              D ]$  }d|z  z   }t        |       t               }||z  }& |S r  r   r   r   nthreadsr  r   
local_maskgntrn  masks        rV   udtz6TestParforReductionSetNumThreads.test_add.<locals>.udt
  K    CH%AYT\

+%'s
	 
 JrX   r   r  r   r  rn  rS   rn  r  expectrr  rn  r  s        @@rV   test_addz)TestParforReductionSetNumThreads.test_add  `    $$E1u	t		 
	 T"$i,rX   c                     t        dt        j                        }d|z  |dz
  t        d      fd       }|j	                        } |      }| j                  ||       y )Nr   r   r   Tr   c                     d}t        |        t              D ]$  }d|z  z   }t        |       t               }||z  }& |S r  r  r  s        rV   r  z6TestParforReductionSetNumThreads.test_mul.<locals>.udt   r  rX   )r  r   r  r   r  rn  r  s        @@rV   test_mulz)TestParforReductionSetNumThreads.test_mul  si     6++,E1u	t		 
	 T"$i,rX   c                     t         j                  }d|z  |dz
  t        d      fd       }|j                        } |      }| j	                  ||       y )Nr   r   Tr   c                     d}t        |        t              D ]+  }d|z  z   }t        |       t               }t        ||      }- |S r  )r   r   r   r  r  s        rV   r  z6TestParforReductionSetNumThreads.test_max.<locals>.udt4  sM    CH%AYT\

+%'#sm	 
 JrX   r  r  s        @@rV   r
  z)TestParforReductionSetNumThreads.test_max/  r  rX   N)rw   rN   rx   rC  r  r  r
  r|   rX   rV   r  r    s    -(-,-rX   r  c                   :    e Zd Z ej                         d        Zy)TestDiagnosticEnvVarc                     dt         j                  d<   t               5 }t        d      d        } |        d d d        j	                         }| j                  d|       y # 1 sw Y   ,xY w)N4NUMBA_PARALLEL_DIAGNOSTICSTr   c                  ~    d} t        j                  | t         j                        }t        |       D ]  }d||<   	 |S )Nr  r
  r   )r   r$  r{  r   )r   r   r   s      rV   r   z<TestDiagnosticEnvVar.test_diagnostics_env_var1.<locals>.implJ  s7    HHa

3AAaD #rX   zParallel Accelerator Optimizing)r  r  r4   r   r  r   )rS   r  r   
the_outputs       rV   test_diagnostics_env_var1z.TestDiagnosticEnvVar.test_diagnostics_env_var1F  sb    14

/0&4  ! F  __&
7D s   A##A,N)rw   rN   rx   r3   r  r  r|   rX   rV   r  r  D  s!    $X$$&E 'ErX   r  __main__rZ   )rf  r  r)  r  r   rz   r  
subprocessr   r  r  	functoolsr   r  r   numpy.randomr   rY  collectionsr   r   r   	itertoolsr	   r
   r  numba.parfors.parforr   r   r   r   r   r   r   r   r   
numba.corer   r   r   r   r   r   r   r   numba.typedr   r   numba.extendingr   r   r    r!   r"   r#   numba.core.registryr$   numba.core.annotationsr%   numba.core.ir_utilsr&   r'   r(   r)   r*   r+   r,   numba.np.unsafe.ndarrayr-   r  numba.core.compilerr.   r/   numba.core.compiler_machineryr0   r1   numba.core.typed_passesr2   numba.tests.supportr3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   numba.core.extendingrA   numba.core.bytecoderB   rC   r  rW  rE   rX  r{   x86_onlyr  r  r   r   r   rY  ra  rt  r  r   r  r  r  r  r  r  r  r  r'  r  r  ro  r  rQ  rZ  r  r  r  r  r  r  r  r  r  r  r8  ri  r  r  rw   mainr|   rX   rV   <module>r     s    	 	 
   
        /  "  = = =Q Q Q "F F * 3; ; ; C B E 2@ @ @ @ 2 4    : : :z 8??+8++-5GGY  ,.@A	 ^h ^ ^B	 ?B	A$"D
 D	
!6 
! h@o h@ h@V 'Ko 'K 'KT VOo VO VOr2X 2, x/ x xv! # # #4 f% f% f%R	 "; "; ";J :M :M :Mz q/o q/ q/h zD_ zD zDzT_ Tn a1n a1 a1H   {) {) {)z w2H w2 w2t 	A@N A@ 
 A@H ?-x ?- ?-D E8 E E$ zHMMO rX   