+
    /i                     F   ^ RI t ^ RIt^ RIt^ RIt^ RIHtHtHtHtH	t	H
t
 ^ RIHt ^ RIHt ^ RIHtHtHtHtHtHt ]P,                  P.                  tRtR tR tR	 tR
 tR tR tR tR t R t!R t"R t#R t$R t%R t&R t'R t(R t)R t*R t+R t,R t-R t.R t/R t0R t1R  t2]
! ]4       ! R! R"4      4       t3]
! ]4      ]P,                  Pi                  R#R$.4      ]P,                  Pi                  R%R&.4      ]P,                  Pi                  R'. R7O4       ! R( R)4      4       4       4       4       t5 ! R* R+4      t6 ! R, R-4      t7 ! R. R/4      t8]P,                  P/                  R0]R17      ]P,                  P/                  R2]R17       ! R3 R44      4       4       t9 ! R5 R6]4      t:R# )8    N)array_namespacexp_assert_closexp_size	np_compatis_array_api_strictmake_xp_test_case)cubature)_InfiniteLimitsTransform)Rule	FixedRuleNestedFixedRuleGaussLegendreQuadratureGaussKronrodQuadratureGenzMalikCubaturez2JAX/Dask arrays do not support boolean assignment.c                 Z    VP                  V R4      pVP                  VR4      pW4,          #    )r   r   )r   r   r   reshape)xnxp
x_reshaped
n_reshapeds   &&&  a/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/integrate/tests/test_cubature.pybasic_1d_integrandr   "   s+    Az*JAz*J!!    c                 ^    VP                  ^V ^,           ,          V ^,           ,          R4      # )   r   r   r   r   r   s   &&r   basic_1d_integrand_exactr#   )   s#    ::a!A#h!ng..r   c                 v    VP                  VP                  V RR7      R4      VP                  VR4      ,          # )r   axisr   r!   r   r   )r   sum)r   r   r   s   &&&r   basic_nd_integrandr)   .   s0    ::bffQRf('2BJJq'4JJJr   c                     ^^V ,           ,          ) ^^V ,           ,          ,           ^V ,           ^V ,           ,          ,          # r     r"   s   &&r   basic_nd_integrand_exactr-   2   s0    1XIAaC AaC!A#;//r   c                f   V P                   ^ ,          V P                   R,          rTVR,          pVP                  W.^.\        VP                   4      ^,
          ,          OVN54      pVP                  ^\        P
                  ,          V,          VP                  Wg,          RR7      ,           4      # )z
.. math:: f_1(\mathbf x) = \cos\left(2\pi r + \sum^n_{i = 1}\alpha_i x_i\right)

.. code-block:: mathematica

    genzMalik1980f1[x_List, r_, alphas_List] := Cos[2*Pi*r + Total[x*alphas]]
r%   r   N.)shaper   lencosmathpir(   )r   ralphasr   npointsndimalphas_reshapedr   s   &&&&    r   genz_malik_1980_f_1r:   7   s     GGAJTY'OANA3FLL0AA0E+FNNOJ66!DGG)A+'C" MMNNr   c           	      ~   \        V 4      pVP                  V . ^.\        VP                  4      ^,
          ,          OVN54      p VP                  V. ^.\        VP                  4      ^,
          ,          OVN54      pRV,          ^,          VP	                  VRR7      ,          VP                  ^\        P                  ,          V,          VP                  W0V,           ,          R,          RR7      ,           4      ,          VP	                  VP                  W0V,
          ,          ^,          4      RR7      ,          # )r   r%         ?r   )
r   r   r1   r0   prodr2   r3   r4   r(   sin)abr5   r6   r   r8   s   &&&&& r   genz_malik_1980_f_1_exactrB   H   s    1:D


1<!c&,,/!34<t<=A


1<!c&,,/!34<t<=A 
d

	GGFG$	%
&&4771rvvf!ns&:vDD
E	F ''"&&Q3)*'
4	5r   c                     VP                  V P                  VR R 4      4      pVP                  V P                  V4      4      p^	pVP                  VRR7      R,          pWT,          V,          pW43# )Nr%   r   .Nasarrayrandomr(   )rngr0   r   r5   r6   
difficultynormalisation_factorss   &&&    r   genz_malik_1980_f_1_random_argsrK   U   si    


3::eCRj)*AZZ

5)*FJFF6F3I> #88F;r   c                L   V P                   ^ ,          V P                   R,          rTVR,          pVR,          pVP                  W.^.\        VP                   4      ^,
          ,          OVN54      p^VP                  V^,          W,
          ^,          ,           RR7      ,          # )z
.. math:: f_2(\mathbf x) = \prod^n_{i = 1} (\alpha_i^2 + (x_i - \beta_i)^2)^{-1}

.. code-block:: mathematica

    genzMalik1980f2[x_List, alphas_List, betas_List] :=
        1/Times @@ ((alphas^2 + (x - betas)^2))
r%   r   r/   )r0   r   r1   r>   	r   r6   betasr   r7   r8   r9   betas_reshapedr   s	   &&&&     r   genz_malik_1980_f_2rP   `   s     GGAJTY'O9%NANA3FLL0AA0E+FNNOJRWW_a':+Dq*HHrWRRRr   c                    \        V 4      pVP                  V . ^.\        VP                  4      ^,
          ,          OVN54      p VP                  V. ^.\        VP                  4      ^,
          ,          OVN54      pRV,          ^,          VP	                  VRR7      ,          VP	                  VP                  W,
          V,          4      VP                  W,
          V,          4      ,
          RR7      ,          # r   r%   r   )r   r   r1   r0   r>   atanr@   rA   r6   rN   r   r8   s   &&&&& r   genz_malik_1980_f_2_exactrU   s   s    1:D


1<!c&,,/!34<t<=A


1<!c&,,/!34<t<=A 
d
QrwwvBw//
''GGQY&'"''19f2D*EE  
	
r   c                    VR,          pVP                  V P                  V4      4      pVP                  V P                  V4      4      pRpVP                  WBP                  R4      ,          RR7      pWrP                  ^^V,          ,          4      ,          R,          pWH,          \        P                  ! V^^V,          ,          4      ,          pV^
,          pWE3# )r   g      9@r%   r   g       rD   )rF   rG   r>   r3   pow)	rH   r0   r   r8   r6   rN   rI   productsrJ   s	   &&&      r   genz_malik_1980_f_2_random_argsrY      s    9DZZ

5)*FJJszz%()EJwwvzz$//bw9H%zz!qv,'??K+dhhz1$<.PPF bLF=r   c                    V P                   ^ ,          V P                   R,          rCVR,          pVP                  W.^.\        VP                   4      ^,
          ,          OVN54      pVP                  VP	                  WV,          RR7      4      # )z
.. math:: f_3(\mathbf x) = \exp\left(\sum^n_{i = 1} \alpha_i x_i\right)

.. code-block:: mathematica

    genzMalik1980f3[x_List, alphas_List] := Exp[Dot[x, alphas]]
r%   r   r/   r0   r   r1   expr(   r   r6   r   r7   r8   r9   r   s   &&&    r   genz_malik_1980_f_3r^      st     GGAJTY'OANA3FLL0AA0E+FNNOJ66"&&5B&?@@r   c                    \        V 4      pVP                  V . ^.\        VP                  4      ^,
          ,          OVN54      p VP                  V. ^.\        VP                  4      ^,
          ,          OVN54      pRV,          ^,          VP	                  VRR7      ,          VP	                  VP                  W ,          4      VP                  W!,          4      ,
          RR7      ,          # rR   )r   r   r1   r0   r>   r\   )r@   rA   r6   r   r8   s   &&&& r   genz_malik_1980_f_3_exactr`      s    1:D


1<!c&,,/!34<t<=A


1<!c&,,/!34<t<=A 
d
QrwwvBw//
''"&&$rvvfj'99'
C	Dr   c                     VP                  V P                  V4      4      pVP                  VRR7      R,          pRpWS,          V,          pV3# )r   r%   g      (@r   rD   rE   )rH   r0   r   r6   rJ   rI   s   &&&   r   genz_malik_1980_f_3_random_argsrb      sL    ZZ

5)*FFF6F3I>J #88F9r   c                .   V P                   ^ ,          V P                   R,          rCVR,          pVP                  W.^.\        VP                   4      ^,
          ,          OVN54      p^VP                  WV,          RR7      ,           V) ^,
          ,          # )z
.. math:: f_4(\mathbf x) = \left(1 + \sum^n_{i = 1} \alpha_i x_i\right)^{-n-1}

.. code-block:: mathematica
    genzMalik1980f4[x_List, alphas_List] :=
        (1 + Dot[x, alphas])^(-Length[alphas] - 1)
r%   r   r/   )r0   r   r1   r(   r]   s   &&&    r   genz_malik_1980_f_4rd      s{     GGAJTY'OANA3FLL0AA0E+FNNOJ3"==$qIIr   c                 H   aaa \        V 4      oVVV3R  lp\        W@VS4      # )c                 :  < SP                  V . ^.\        SP                  4      ^,
          ,          OSN54      pRS,          SP                  SRR7      ,          \        P
                  ! S4      ,          ^SP                  SV,          RR7      ,           ,          # rR   )r   r1   r0   r>   r3   	factorialr(   )r   r   r6   r8   r   s   & r   F$genz_malik_1980_f_4_exact.<locals>.F   s    ZZ#Iqc3v||+<q+@&A#ID#IJ
 $JrwwvBw//nnT"#266&:-B6779	
r   )r   _eval_indefinite_integral)r@   rA   r6   r   rh   r8   s   &&ff @r   genz_malik_1980_f_4_exactrk      s"    1:D
 %Q1b11r   c                   \        V4      pVP                  W.^ R7      p^ p\        P                  ! \	        ^4      VR7       F|  pTP                  \        V\	        V4      4       UU	u. uF  w  r\        WXV	3,          4      NK  	  up	p4      p
V\        R\        V4      V,           4      V ! V
4      ,          ,          pK~  	  V# u up	pi )z{
Calculates a definite integral from points `a` to `b` by summing up over the corners
of the corresponding hyperrectangle.
r%   )repeatr   )
r   stack	itertoolsproductrangerF   zipfloatrW   r(   )rh   r@   rA   r   r8   pointsoutindijselected_pointss   &&&&       r   rj   rj      s     1:DXXqf1X%F
C  q$7**-0eDk-BC-BTQU6Q$< -BC
 	s2s3x$'!O*<<<	 8 J	 Ds   )Cc                     VR,          pVP                  V P                  V4      4      pVP                  VRR7      R,          pRpWc,          V,          V,          pV3# )r   r%   g      ,@r   rD   rE   )rH   r0   r   r8   r6   rJ   rI   s   &&&    r   genz_malik_1980_f_4_random_argsr{      sZ    9DZZ

5)*FFF6F3I>J6),AAF9r   c                ^   V P                   ^ ,          V P                   R,          rTVR,          pVR,          pVP                  W.^.\        VP                   4      ^,
          ,          OVN54      pVP                  VP	                  V^,          W,
          ^,          ,          RR7      ) 4      # )z
.. math::

    f_5(\mathbf x) = \exp\left(-\sum^n_{i = 1} \alpha^2_i (x_i - \beta_i)^2\right)

.. code-block:: mathematica

    genzMalik1980f5[x_List, alphas_List, betas_List] :=
        Exp[-Total[alphas^2 * (x - betas)^2]]
r%   r   r/   r[   rM   s	   &&&&     r   genz_malik_1980_f_5r}      s     GGAJTY'O9%NANA3FLL0AA0E+FNNOJ66	"j&AA%EEB	OO r   c           	      x   \        V 4      pVP                  V . ^.\        VP                  4      ^,
          ,          OVN54      p VP                  V. ^.\        VP                  4      ^,
          ,          OVN54      pRV,          ^,          VP	                  VRR7      ,          \
        P                  V^,          ,          ,          VP	                  \        P                  P                  W#V ,
          ,          4      \        P                  P                  W!V,
          ,          4      ,           RR7      ,          # )r   r%   r<   r   )
r   r   r1   r0   r>   r3   r4   scipyspecialerfrT   s   &&&&& r   genz_malik_1980_f_5_exactr     s    1:D


1<!c&,,/!34<t<=A


1<!c&,,/!34<t<=A 
t
	GGFG$	%77T!V	 ''MMf	23mme) 456  
	
	r   c                 N   VP                  V P                  V4      4      pVP                  V P                  V4      4      pR pVP                  VP                  W2P                  R4      ,          RR7      4      R,          pW6,          \        P                  ! V4      ,          pW43# )g      5@g       @r%   r   rD   )rF   rG   sqrtr(   r3   )rH   r0   r   r6   rN   rI   rJ   s   &&&    r   genz_malik_1980_f_5_random_argsr     s    ZZ

5)*FJJszz%()EJGGBFF6::c?+BF$LMiX+dii
.CCF=r   c                0   V P                   ^ ,          V P                   R,          rCVR,          pVP                  W.^.\        VP                   4      ^,
          ,          OVN54      pVP                  VP	                  WV,          ^,          RR7      ) 4      # )zR
.. math::

    f(\mathbf x) = \exp\left(-\sum^n_{i = 1} (\alpha_i x_i)^2 \right)
r%   r   r/   r[   r]   s   &&&    r   
f_gaussianr   )  s|     GGAJTY'OANA3FLL0AA0E+FNNOJ66266?7!;"6EEFFr   c                    \        V 4      p^ p^ p\        V4       F  pVP                  W,          4      '       d)   VP                  W,          4      '       d   V^,          pKH  VP                  W,          4      VP                  W,          4      8w  g   K{  V^,          pK  	  \        P                  ! \        P
                  4      V,          ^V,          VP                  VRR7      ,          ,          # )r   r%   r   )r   rq   isinfr3   r   r4   r>   )r@   rA   r6   r   r8   double_infinite_countsemi_infinite_countrw   s   &&&&    r   f_gaussian_exactr   6  s     1:D4[88AD>>bhhqtnn!Q&!XXad^rxx~-1$	  IIdgg$&	b!99 r   c                 Z    VP                  V P                  V4      4      pV^d,          pV3# )d   )rF   rG   )rH   r0   r   r6   s   &&& r   f_gaussian_random_argsr   L  s,    ZZ

5)*F cMF9r   c                   V R,          V R,          V R,          V R,          3w  r4rVW1R,          ,          VP                  V4      ,          VP                  V) V^,          ,
          V^,          ,
          4      ,          pVP                  # )z>
.. math::

    f(x, y, z, w) = x^n \sqrt{y} \exp(-y-z^2-w^2)
NNNr   )r   r   )r   r    )r      )r   N)r   r\   T)x_arrr   r   r   yzwress   &&&     r   f_modified_gaussianr   V  sg     teDk5;dCJA!'
?bggaj
(2661"QT'!Q$,+?
?C55Lr   c                 h    ^^^V,          ,           ,          \         P                  R,          ,          # )r   g      ?)r3   r4   )r@   rA   r   r   s   &&&&r   f_modified_gaussian_exactr   b  s$    
 a!A#g;S)))r   c                    V F'  pVP                  W8H  4      '       g   K  \        R4      h	  VP                  V P                  ^ ,          4      # )z
This emulates a function with a list of singularities given by `points`.

If no `x_arr` are one of the `points`, then this function returns 1.
called with a problematic point)any
ValueErroronesr0   )r   rt   r   points   &&& r   f_with_problematic_pointsr   j  sD     66%.!!>??  775;;q>""r   c                      a  ] tR tRt o Rt]P                  P                  R. RO4      R 4       tR t	R t
R tR tR	 tR
 tR tRtV tR# )TestCubatureix  z/
Tests related to the interface of `cubature`.
rule_strc                (   VP                  ^VP                  R7      pVP                  ^ ^ .VP                  R7      pVP                  ^^.VP                  R7      p\        \        WEWV3R7      p\        VP                  \        W24      R^ R7       R# )   dtype)ruleargs:0yE>rtolatolN)arangefloat64rF   r	   r)   r   estimater-   )selfr   r   r   r@   rA   r   s   &&&    r   test_pass_strTestCubature.test_pass_str~  s~     IIarzzI*JJ1vRZZJ0JJ1vRZZJ0)1hWMLL$Q+		
r   c                    \         P                  ! ^\         P                  R7      p^ .p^.p\        \        VVV\         3R7      p\        VP                  \        V\         4      R^ R7       R# r   r   r   r   r   N)r   r   r   r	   r   r   r   r#   )r   r   r@   rA   r   s   &    r   test_pass_array_like_not_array+TestCubature.test_pass_array_like_not_array  sc    Qi&7&78CCY	
 	LL$Q	2		
r   c                   VP                  ^ .4      pVP                  ^.4      p\        4       p\        \        VVV^
VP	                  ^VP
                  R7      V3R7      pVP                  ^
8X  g   Q hVP                  R8X  g   Q hR# )r   r   )r   max_subdivisionsr   not_convergedN)rF   BadErrorRuler	   r   r   r   subdivisionsstatus)r   r   r@   rA   r   r   s   &&    r   !test_stops_after_max_subdivisions.TestCubature.test_stops_after_max_subdivisions  s    JJsOJJsO~))ARZZ)0"5
 2%%%zz_,,,r   c           	     *   VP                  ^ ..VP                  R7      pVP                  ^..VP                  R7      p\        P                  ! \        RR7      ;_uu_ 4        \        \        W#V3R7       RRR4       R#   + '       g   i     R# ; i)r   r   z`a` and `b` must be 1D arraysmatchr   N)rF   r   pytestraises	Exceptionr	   r   r   r   r@   rA   s   &&  r   test_a_and_b_must_be_1d$TestCubature.test_a_and_b_must_be_1d  sg    JJuBJJJ/JJuBJJJ/]]9,KLL'RE: MLLLs   #BB	c           	         VP                  . 4      pVP                  . 4      p\        P                  ! \        R R7      ;_uu_ 4        \	        \
        W#V3R7       RRR4       R#   + '       g   i     R# ; i)z`a` and `b` must be nonemptyr   r   N)rF   r   r   r   r	   r   r   s   &&  r   test_a_and_b_must_be_nonempty*TestCubature.test_a_and_b_must_be_nonempty  sM    JJrNJJrN]]9,JKK'RE: LKKKs   A%%A6	c           
     \   VP                  ^VP                  R7      pVP                  ^ .VP                  R7      pVP                  ^ .VP                  R7      p\        \        VVW!3R7      p\        VP                  VP                  ^ .^ .^ .^ .^ ..VP                  R7      R^ R7       R# r   )r   r   rF   r	   r   r   r   r   r   r   r@   rA   r   s   &&    r   test_zero_width_limits#TestCubature.test_zero_width_limits  s    IIarzzI*JJs"**J-JJs"**J-	
 	LLJJaS1#sQC0

JC		
r   c                &   VP                  ^VP                  R7      pVP                  ^.VP                  R7      pVP                  ^ .VP                  R7      p\        \        VVW!3R7      p\        VP                  \        W!4      ) R^ R7       R# r   )r   r   rF   r	   r   r   r   r#   r   s   &&    r   test_limits_other_way_around)TestCubature.test_limits_other_way_around  s    IIarzzI*JJs"**J-JJs"**J-	
 	LL%a,,		
r   c                f   \        \        VP                  ^ .VP                  R7      VP                  ^.VP                  R7      . VP                  ^.VP                  R7      V3R7      P                  P
                  pW!P                  8X  g   Q h\        \        VP                  ^ .VP                  R7      VP                  ^.VP                  R7      . VP                  ^.VP                  R7      V3R7      P                  P
                  pW!P                  8X  g   Q h\        \        VP                  ^ .VP                  R7      VP                  ^.VP                  R7      . VP                  ^.VP                  R7      V3R7      P                  P
                  pW!P                  8X  g   Q hR# )r   r   )rt   r   N)r	   r   rF   r   r   r   float32)r   r   result_dtypes   && r   $test_result_dtype_promoted_correctly1TestCubature.test_result_dtype_promoted_correctly  sg   JJs"**J-JJs"**J-**aS

*3R8
 (55 	 zz)))JJs"**J-JJs"**J-**aS

*3R8
 (55 	 zz)))JJs"**J-JJs"**J-**aS

*3R8
 (55 	 zz)))r   r,   N)zgauss-kronrod
genz-malikgk21gk15)__name__
__module____qualname____firstlineno____doc__r   markparametrizer   r   r   r   r   r   r   r   __static_attributes____classdictcell____classdict__s   @r   r   r   x  s\      [[Z * 


&-";;
(
(* *r   r   r   g-C6?r   gh㈵>r   c                   
  a  ] tR tRt o Rt]! RRR7      ]P                  P                  R]	]
^ .^
.R^.33]	]
^ ^ .^^.R^^.33]	]
^ ^ .^^.R^^.33]	]
. R"O. R#OR. R$O33]]R%.^.^.^.33]]^ ^ .^
^2.R&^.R'^.33]]. R"O. R$O. R$O. R$O33]]. R"O. R$O. R(O. R(O33]]. R)O. R$O. R$O. R*O33]]. R+O. R,O. R,O. R,O33]]R%.^.R.33]]^ R%.^^.^^.33]]. R)O. R$O. R$O33]]^ .^.^.33]]^ ^ .^^.^^.33]]. R"O. R$O. R$O33]]R%.^.R'.^.33]]R%R%.^^.^^.^^.33]]R%R%.^^.R%^.^ ^ .33]]. R)O. R$O. R$O. R$O33.4      R 4       4       t]! RRR7      ]P                  P                  R]	]
]3]]]3]]]3]]]3]]]3.4      ]P                  P                  R. R.O4      R	 4       4       4       t]P                  P                  RR
 R.^ .^
.R3R R.R%.^.R..3R R.. R"O. R$O. R/O.3R R.. R"O. R$O. R0O. R/O.3R R.. R"O. R$O. R1O. R0O. R/O.3.4      R 4       t]P                  P                  R]R7      ]P                  P                  R]R7      ]P                  P                  R]]]R2]P@                  ) .]P@                  .3]]]R3]P@                  ) ]P@                  ) .]P@                  ]P@                  .3]]]R2^ .]P@                  .3]]]R2]P@                  ) .^ .3]]]R3^ ^ .]P@                  ]P@                  .3]]]R3^ ]P@                  ) .]P@                  ]P@                  .3]]]R-^ ^ ]P@                  ) ]P@                  ) .]P@                  ]P@                  ]P@                  ]P@                  .3]]]R-]P@                  ) ]P@                  ) ]P@                  ) ]P@                  ) .^ ^ ]P@                  ]P@                  .3R R R ]!! 4       ^]P@                  ) ^.]P@                  R']P@                  .3]PD                  ! ]#]$R ]!! 4       ^ ^ ]P@                  ) ]P@                  ) .^]P@                  ]P@                  ]P@                  .3]P                  PJ                  R7      .
4      R 4       4       4       t&]P                  P                  R]R7      ]P                  P                  R]R7      ]P                  P                  RR R4]PN                  ,          .]P@                  ) .]P@                  .^ ..3R R4]PN                  ,          ]P@                  ) ^ .]P@                  ^.^ R..3.4      R  4       4       4       t(R!t)V t*R# )5TestCubatureProblemsi  z1
Tests that `cubature` gives the correct answer.

dask.arrayz0Dask hangs/takes a long time for some test casesreasonproblemc           
     "  a Vw  rgrp
SP                  VSP                  R 7      pSP                  V	SP                  R 7      p	\        ;QJ d    . V3R lV
 4       F  NK  	  5M! V3R lV
 4       4      p
\        V4      pVR8X  d   V^8  d   \        P
                  ! R4       \        VVV	VVV. V
OSN5R7      pVP                  R8X  g   Q hVP                  pV! W.V
OSN5!  p\        VVVVRVP                   RVP                   2R7       R	# )
r   c              3   ^   <"   T F"  pSP                  VSP                  R 7      x  K$  	  R# 5i)r   NrF   r   ).0argr   s   & r   	<genexpr>:TestCubatureProblems.test_scalar_output.<locals>.<genexpr>  s%     G$3RZZ2::Z66$s   *-r   1Genz-Malik cubature does not support 1D integralsr   r   r   r   	convergedestimate_error=, subdivisions=r   r   err_msgN)rF   r   tupler   r   skipr	   r   r   r   errorr   )r   r   r   r   r   r   fexactr@   rA   r   r8   r   est	exact_sols   &&&&&f         r   test_scalar_output'TestCubatureProblems.test_scalar_output  s   l  '!JJq

J+JJq

J+uG$GuuG$GGqz<D1HKKKL4
 zz[(((ll!**r*	%cii[@P@P?QR	
r   r0   c           
     H   \         P                  P                  ^4      pVR,          pVR8X  d   V^8  d   \        P                  ! R4       VR8X  d'   V^8  d    \        P
                  P                  R4       Vw  rpV! WsV4      pVP                  ^ .V,          VP                  R7      pVP                  ^.V,          VP                  R7      p\        V	VVVVV. VOVN5R7      pVP                  pV
! W.VOVN5!  p\        VVVVRVP                   RVP                   2R7       RVP                   R	VP                   R
VP                  VP                  V,
          4       2pVP                  R8X  g   Q V4       hVP                  P                   VRR 8X  g   Q hR# )r   r   r   !Gauss-Kronrod is slow in >= 5 dimr   r   r   r   r   , subdivisions= , true_error=r   Nr   )r   rG   default_rngr   r   r   slowrF   r   r	   r   r   r   r   absr   r0   )r   r   r   r0   r   r   r   rH   r8   r  r  random_argsr   r@   rA   r   r  r  r   s   &&&&&&&            r   test_array_output&TestCubatureProblems.test_array_output  s   \ **1-Ry<D1HKKKL<DAIKK@A '+3r*JJsTzJ4JJsTzJ44
 ll!**r*	%cii[@P@P?QR	
 %SYYK 0$$'$4$4#5 6!!#y(@!A BD zz[(1'1(||!!U3BZ///r   c                    V # Nr,   r   r   s   &&r   <lambda>TestCubatureProblems.<lambda>m  s    !r   g      I@Nc                2    VP                  V 4      V ,          # r  r?   r  s   &&r   r  r  |  s    "&&)A+r   gBsvi@g        c                J    VP                  V P                  ^ ,          ^34      # r   r   r0   r  s   &&r   r  r        "''1771:q/2r   g      ?r<   c                J    VP                  V P                  ^ ,          ^34      # r  r  r  s   &&r   r  r    r  r         ?c                J    VP                  V P                  ^ ,          ^34      # r  r  r  s   &&r   r  r    r  r   c                   Vw  rgrp
VP                  WP                  R 7      pVP                  WP                  R 7      p	VP                  WuP                  R 7      pV
e+   V
 Uu. uF  qP                  WP                  R 7      NK   	  p
p\        V4      pVR8X  d   V^8  d   \        P                  ! R4       VR8X  d'   V^8  d    \        P
                  P                  R4       \        VVV	VVVV
V3R7      p\        VP                  VVVRVP                   RVP                   2RR	7       RVP                   R
VP                   RVP                  VP                  V,
          4       2pVP                  R8X  g   Q V4       hR# u upi )r   Nr   r   r  r   r   r   rt   r   r   r   F)r   r   r   check_dtyper	  r
  r   )rF   r   r   r   r   r   r  r	   r   r   r   r   r  r   )r   r   r   r   r   r   r  r  r@   rA   rt   r   r8   r   r   s   &&&&&&         r   test_break_points&TestCubatureProblems.test_break_pointsj  sx   t ")!JJq

J+JJq

J+

5


3GMNvejjjjj9vFNqz<D1HKKKL<DAIKK@A	
 	LL%cii[@P@P?QR	
 %SYYK 0$$'$4$4#5 6!!#u(<!= >@ zz[(1'1(C Os   #$F	jax.numpyc                D    ^VP                  V RR7      ^,          ,          # rR   )r>   r  s   &&r   r  r    s    !BGGABG/22r   c                <    VP                  RVP                  R7      # )r   r   gUUUUUU?r   )r@   rA   r   s   &&&r   r  r    s    RZZ2::Z>r   c                    \        4       # r  )r   rH   r0   r   s   &&&r   r  r    s    57r   c                B    VP                  . ROVP                  R7      3# )r   r   )r   r   r    r      r   r(  s   &&&r   r  r  0  s    

?"**
(U'Wr   )marksc           
        \         P                  P                  ^4      pVw  rxrrVP                  WP                  R7      pVP                  WP                  R7      pV	! WjV4      p\        V4      pVR8X  d   V^8  d   \        P                  ! R4       VR8X  d'   V^8  d    \        P                  P                  R4       VR8X  d8   V^8  d1   \        V4      '       d    \        P                  P                  R4       \        VVVVVV. VOVN5R7      pVP                  R8X  g   Q h\        VP                  V! W.VOVN5!  VVRVP                    R	VP"                   2R
R7       R# )r   r   r   r   zGenz-Malik is slow in >= 5 dimz5Genz-Malik very slow for array_api_strict in >= 4 dimr   r   error_estimate=r   Fr   r   r   check_0dN)r   rG   r  rF   r   r   r   r   r   r  r   xslowr	   r   r   r   r   r   )r   r   r   r   r   r   rH   r  r  random_args_funcrandom_args_shaper@   rA   r   r8   r   s   &&&&&&          r   test_infinite_limits)TestCubatureProblems.test_infinite_limits  sM   Z **1->E;"qJJq

J+JJq

J+;qz<D1HKKKL<DAIKK=><DAI2Eb2I2IKKUV4
 zz[(((LL!""r"%cii[@P@P?QR	
r   c                @    VP                  V 4      V ,          ^,          # )   r  r  s   &&r   r  r  g  s    266!9q=1,r   c                \    VP                  V R,          4      V R,          ,          ^,          # )r   r   r  r  s   &&r   r  r  v  s    266!D'?QtW4q8r   c                6   Vw  rgrp
VP                  WP                  R 7      pVP                  WP                  R 7      p	VP                  WuP                  R 7      p\        V4      pVR8X  d   V^8  d   \        P                  ! R4       V
e+   V
 Uu. uF  qP                  WP                  R 7      NK   	  p
p\        VVV	VVVV
V3R7      pVP                  R8X  g   Q h\        VP                  VVVRVP                   RVP                   2RR	7       R# u upi )
r   r   r   Nr   r   r-  r   Fr.  )rF   r   r   r   r   r	   r   r   r   r   r   )r   r   r   r   r   r   r  r  r@   rA   rt   r8   r   r   s   &&&&&&        r   %test_infinite_limits_and_break_points:TestCubatureProblems.test_infinite_limits_and_break_pointsb  s   F ")!JJq

J+JJq

J+

5


3qz<D1HKKKLGMNvejjjjj9vFN	
 zz[(((LL%cii[@P@P?QR	
 Os   $D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    )r   r   r=  )r   r    )r   r*  r    )r    r   r   )r<   r<   r<   )r  r  r  )g?r  r<   )r   r   )r    r    g?)+r   r   r   r   r   skip_xp_backendsr   r   r   r:   rB   rP   rU   r^   r`   rd   rk   r}   r   r  rK   rY   rb   r{   r   r  r"  boolean_index_skip_reasonr   r   r   r3   infr   paramr   r   r0  r3  r4   r9  r   r   r   s   @r   r   r     s+     lOQ[[Y   & C D 	
(  %FFA		
  %FFA		
  %		
  %DC		
  %FHQQ
	
  %		
  %		
  %		
  %		
  %DC	
  %GFA	
  %	
  %CC	
  %FFVI	
  %L	
  %DC		
  %HFAA		
  %HFQA		
  %		
QR) Rf!
gRQj!
F lOQ[[Y   & ,		
  %+	
  %+	
  %+	
  %+	
5) @ [[W 
' 
*0
AQZ*0X [[Y  F C D 	
" &DC	
 3E	
 3E"		
 3E "
	
[8) 8r)2s8r)2V [[!!+6O!P[[!!,7P!Q[[Y   # hhYKXXJ	
  "hhY	"XXtxx 	
 "CXXJ	
 "hhYKC	
 "FXXtxx 	
 "	NXXtxx 	
 "DHH9txxi(XXtxx4884	
 "hhY	DHH9txxi8488TXX&	
 3 ? +G	1XXr488$	
 	 $ * XAy488),DHHdhh1 ++##!	
oi) iT&
Ui R QX&
P [[!!+6O!P[[!!,7P!Q[[Y - tww hhYKXXJ SE	
" 9 dgg hhYNXXqM XJ	
!) @#
A R QD#
r   r   c                      a  ] tR tRt o Rt]P                  P                  R^ ^ .^^.]R3^ .^.]	R	3.4      R 4       t
R tRtV tR# )
	TestRulesi  zB
Tests related to the general Rule interface (currently private).
r   c           	     D   Vw  r4rVV! VR V/ pVP                  W2P                  R7      pVP                  WBP                  R7      p\        P                  ! \        RR7      ;_uu_ 4        VP                  \        W4V3R7       RRR4       R#   + '       g   i     R# ; i)r   r   zincompatible dimensionr   r   N)rF   r   r   r   r   r   r   )r   r   r   r@   rA   
quadraturequadrature_argsr   s   &&&     r   (test_incompatible_dimension_raises_error2TestRules.test_incompatible_dimension_raises_error  s|    " -4)j?2r2JJq

J+JJq

J+]]9,DEEMM,a"M? FEEEs   *BB	c           
     4   VP                  ^ .4      pVP                  ^.4      p\        4       \        4       3 FG  p\        P                  ! \
        4      ;_uu_ 4        VP                  \        W#V3R7       RRR4       KI  	  R#   + '       g   i     K^  ; i)r   r   N)rF   r   r   r   r   r   r   r   )r   r   r@   rA   
base_classs   &&   r   +test_estimate_with_base_classes_raise_error5TestRules.test_estimate_with_base_classes_raise_error  sl    JJsOJJsO69;/Jy))##$6B5#I *) 0)))s   BBr,   N   r+   )r   r   r   r   r   r   r   r   r   r   rH  rL  r   r   r   s   @r   rD  rD    st      [[Y FF"	
 CC	
)  @! @J Jr   rD  c            	         a  ] tR tRt o Rt]P                  P                  R	]R
3]R3]R3]	R3]	R3.4      R 4       t
]P                  P                  R]]3R3.4      R 4       t]P                  P                  R].4      R 4       tRtV tR# )TestRulesQuadraturei  z0
Tests underlying quadrature rules (ndim == 1).
c                x  aa
 V! VR S/ pSP                  ^SP                  R7      o
V
V3R lpSP                  ^ .SP                  R7      pSP                  ^.SP                  R7      pSP                  ^S
^,           ,          S
^,           ,          R4      pVP	                  WVV4      p	\        V	VR^ R7       R# )r   r   c                 \   < SP                  V R4      pSP                  SR4      pW,          # r   r   )r   r   r   r   r   s   &  r   r  >TestRulesQuadrature.test_base_1d_quadratures_simple.<locals>.f  s,    Az2JAz2J))r   r   r   Nr!   )r   r   rF   r   r   r   )r   r   	rule_argsr   rF  r  r@   rA   r  r   r   s   &&&f      @r   test_base_1d_quadratures_simple3TestRulesQuadrature.test_base_1d_quadratures_simple  s     9,,
IIarzzI*	* JJs"**J-JJs"**J-

1qs8QqS>73&&qQ/		
r   c           	        VP                  ^VP                  R7      pVP                  ^ .VP                  R7      pVP                  ^.VP                  R7      pV^ ,          ! V^ ,          VR7      pV^,          ! V^,          VR7      p\        Wx4      p	\	        \
        WVV	RWC3R7      p
\        V
P                  \        WC4      R^ R7       R# )r   r   r   r   )r   r   r   r   N)	r   r   rF   r   r	   r   r   r   r#   )r   	rule_pairrule_pair_argsr   r   r@   rA   higherlowerr   r   s   &&&&       r   .test_base_1d_quadratures_error_from_differenceBTestRulesQuadrature.test_base_1d_quadratures_error_from_difference  s    
 IIarzzI*JJs"**J-JJs"**J-1nQ/B7!^A.26v-
 	LL$Q+		
r   rF  c                    \         P                  ! \        4      ;_uu_ 4        V! ^VR7       RRR4       R#   + '       g   i     R# ; i)r   rY  N)r   r   r   )r   rF  r   s   &&&r   $test_one_point_fixed_quad_impossible8TestRulesQuadrature.test_one_point_fixed_quad_impossible  s,     ]]9%%qR  &%%%s	   8A		r,   N)r   rU  r>  )r   )
   )   rN  )rZ  r[  )rc  r   )r   r   r   r   r   r   r   r   r   r   rV  r^  ra  r   r   r   s   @r   rQ  rQ    s      [[2	 $'	 $'	 %(	'	'5 

0 [[<
!#:	;WE? 

2 [[\, !!r   rQ  c                   |   a  ] tR tRt o Rt]P                  P                  R]! ^^4      4      R 4       t	R t
RtV tR# )TestRulesCubaturei  z.
Tests underlying cubature rules (ndim >= 2).
r8   c                    \        WR7      P                  w  r4VP                  ^ ,          ^V,          ^V^,          ,          ,           ^V,          ,           ^,           8X  g   Q hR# )z{
Tests that the number of function evaluations required for Genz-Malik cubature
matches the number in Genz and Malik 1980.
rY  N)r   nodes_and_weightsr0   )r   r8   r   nodes_s   &&&  r    test_genz_malik_func_evaluations2TestRulesCubature.test_genz_malik_func_evaluations  sK     %T1CC{{1~!T'QtQwY!64!?!!CCCCr   c                    \         P                  ! \        R R7      ;_uu_ 4        \        ^VR7       RRR4       R#   + '       g   i     R# ; i)zonly defined for ndim >= 2r   rY  N)r   r   r   r   )r   r   s   &&r   test_genz_malik_1d_raises_error1TestRulesCubature.test_genz_malik_1d_raises_error*  s.    ]]9,HIIaB' JIIIs	   =A	r,   N)r   r   r   r   r   r   r   r   rq   rk  rn  r   r   r   s   @r   rf  rf    sA      [[VU1b\2D 3D( (r   rf  r$  r   r   c                      a  ] tR tRt o ]P
                  P                  R^ ^]P                  ) .^]P                  ]P                  .. RO. RO.3.4      R 4       t	Rt
V tR# )TestTransformationsi/  c           	       aa S Uu. uF   pSP                  VSP                  R7      NK"  	  upo\        VV3R lSP                  VSP                  R7      SP                  VSP                  R7      SR7      pS FY  pVP                  SP	                  VR4      4      p\
        P                  ! \        RR7      ;_uu_ 4        V! V4       RRR4       K[  	  R# u upi   + '       g   i     Ku  ; i)z`
Test that break points are correctly mapped under the _InfiniteLimitsTransform
transformation.
r   c                    < \        V SS4      # r  )r   )r   rt   r   s   &r   r  KTestTransformations.test_infinite_limits_maintains_points.<locals>.<lambda>F  s    /62>r   rY  r   r   Nr'   )rF   r   r
   invr   r   r   r   )	r   r@   rA   rt   r   pf_transformedr   transformed_points	   &&&ff    r   %test_infinite_limits_maintains_points9TestTransformations.test_infinite_limits_maintains_points2  s      <BB6a"**Qbjj*16B0>JJq

J+JJq

J+
 E - 1 1"**UG2L My0QRR/0 SR  C SRRs   &C	C  C1r,   N)r@   rA   rt   r;  )r<   rc  rc  )r   r   r   r   r   r   r   r3   rA  ry  r   r   r   s   @r   rq  rq  /  sb      [[1DHH9$((#	
	4 	1	1r   rq  c                   8   a  ] tR tRt o RtRR ltRR ltRtV tR# )r   iS  zH
A rule with fake high error so that cubature will keep on subdividing.
c                V    \        W#4      p\        ^
VR7      pVP                  WW44      # )rc  rY  )r   r   r   )r   r  r@   rA   r   r   
underlyings   &&&&&  r   r   BadErrorRule.estimateX  s+    Q",RB7
""111r   c                R    \        W#4      pVP                  R VP                  R7      # )g    .Ar   )r   rF   r   )r   r  r@   rA   r   r   s   &&&&& r   estimate_errorBadErrorRule.estimate_error^  s#    Q"zz#RZZz00r   r,   N)r,   )	r   r   r   r   r   r   r  r   r   r   s   @r   r   r   S  s     21 1r   r   )r   r   r   );r3   r   ro   r   scipy._lib._array_apir   r   r   r   r   r   scipy.integrater	   scipy.integrate._cubaturer
   scipy.integrate._rulesr   r   r   r   r   r   r   r?  r@  r   r#   r)   r-   r:   rB   rK   rP   rU   rY   r^   r`   rb   rd   rk   rj   r{   r}   r   r   r   r   r   r   r   r   r   r   r   rD  rQ  rf  rq  r   r,   r   r   <module>r     s        % >  ;;// P "/
K0
O"
S&"A"J"2&0"
G,	*# 8P* P* P*f 8$($( " 
S

 S

 ) ) S

l%J %JPE! E!P( (* k2KLl3LM1 1 N M1D14 1r   