+
    nDj\                    t   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ 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HtHt ^ RIHu Ht ^ RIHt ^ RIt^ RIHtHtHtHtH t H!t!H"t"H#t#H$t$H%t%H&t&H't'H(t(H)t)H*t*H+t+H,t, ^ RI-H.t/ ^ RI0H1u H.t2 ^ RI3H4t4H5t5H6t6H7t7H8t8 ^ RI9H:t:H;t; ^ RIH<t<H=t=H>t> ^ RI?H@u HAtB ^ RICHDtD ^ R	IEHFtF ^ R
IGHHtH ^ RIHItJ ^ RIHKtL ^ RIHMtM ]P                  P                  tO]P                  P                  tP]! ]4       ! R R4      4       tQ]! ]R34       ! R R4      4       tRR tSR tTR tUR tVR tW]
3R ltXRQR ltY^#^]
3R ltZR t[ ! R R4      t\]! ]4       ! R R4      4       t]R  t^RRR! lt_]P                  P                  R"R#R$.4      ta]! ] 4       ! R% R&4      4       tb ! R' R(4      tcRSR) ltdR* teR+ tf ! R, R-4      tgR. th]! ]+4       ! R/ R04      4       tiR1 tjR2 tkR3 tl ! R4 R54      tm]! ]*4       ! R6 R74      4       tn ! R8 R94      to ! R: R;4      tpR< tqR= tr]! ]<4       ! R> R?4      4       tsR@ tt ! RA RB4      tu ! RC RD4      tv]! ]=4       ! RE RF]v4      4       tw]! ]=4       ! RG RH]v4      4       tx]! ]>4       ! RI RJ4      4       ty]! ]>4       ! RK RL4      4       tz ! RM RN4      t{ ! RO RP4      t|R# )T    N)xp_assert_equalxp_assert_closexp_default_dtype	concat_1dmake_xp_test_casexp_ravel_xp_copy_to_numpyarray_namespace)raises)BSplineBPolyPPolymake_interp_splinemake_lsq_splinesplevsplrepsplprepsplder
splantidersprootsplintinsertCubicSpline	NdBSplinemake_smoothing_splineRegularGridInterpolator)_not_a_knot_augknt_woodbury_algorithm_periodic_knots_make_interp_per_full_matr)	Fperiodic	root_rati)generate_knotsmake_splrepmake_splprep)	AxisError)_run_concurrent_barrier)make_ndbspl)_fitpack)	_bsplines)_dierckxc                   n  a  ] tR t^2t o R tR tR tR tR tR t	R t
]! RR	R
7      ]! RRR
7      ]! RRR
7      R 4       4       4       tR tR tR tR tR tR tR tR tR tR tR tR tR t]! RRR
7      R 4       tR  tR! tR" tR# tR$ tR% t R& t!]"! RR'R
7      R( 4       t#R) t$R* t%R+ t&]'PP                  PS                  R,]*! RB^4      4      R- 4       t+R. t,R/ t-]'PP                  PS                  R0. RCO4      ]'PP                  PS                  R1]*! ^4      4      R2 4       4       t.R3 t/R4 t0R5 t1]'PP                  PS                  R6. RDO4      R7 4       t2]'PP                  PS                  R6. RDO4      R8 4       t3R9 t4R: t5R; t6]'PP                  Po                  ]8Pr                  R<8H  R=]:R>7      R? 4       t;R@t<V t=RA# )ETestBSplinec                   \        \        \        3\        3/ \	        ^R.R.^ R7      B  \
        P                  ! RR7      ;_uu_ 4        \        \        \        3/ \	        ^\
        P                  .R.^ R7      B  RRR4       \        \        \        3/ \	        ^\
        P                  .R.^ R7      B  \        \        \        3/ \	        ^R
.R.^ R7      B  \        \        \        3/ \	        ^.^..R.^ R7      B  \        \        \        3/ \	        . RO^.^ R7      B  \        \        \        3/ \	        . RORR.^R7      B  \        \        \        3/ \	        . RO. RORR7      B  \        \        \        3/ \	        . RO. RORR7      B  \        \        \        3/ \	        . RO. RO^R7      B  ^^r2VP                  W#,           ^,           VP                  R	7      pVP                  \
        P                  P                  V4      4      p\        WEV4      p\        WFP                  4       \        WVP                  4       W6P                   8X  g   Q hR#   + '       g   i     EL; i)                 ?      ?tckignore)invalidNcubic      @dtyper   r0      r   r0   r?         )        rC   r2          @      @      @)r2   r2   r2   )rC   r   r0   r0   r?   rA   )r2   r0   r0   )assert_raises	TypeError
ValueErrorr   dictnperrstatenaninfarangefloat64asarrayrandomr   r4   r5   r6   )selfxpnr6   r4   r5   bs   &&     _/data/cameron/venvs/s3viz/lib/python3.14/site-packages/scipy/interpolate/tests/test_bsplines.py	test_ctorTestBSpline.test_ctor5   s   y*-w 	1!SbTQ/	1[[***gRBFFtq1QR +j'NTQKB41-MNj'JTQGtq-IJj'MTaS1#J2$!-LM 	j'KTI!-JKj' 	<RH:	< 	i 	O1\WM	Oi 	K1\SI	K 	j' 	B,
a@	B 11IIac!e2::I.JJryy''*+A!3333CCxx; +**s   
3II/	c                r   \        4       pVP                  p\        VP                  V^ ,          RRR7       \        VP                  V^,          RRR7       VP
                  V^,          8X  g   Q h\        P                  ! \        4      ;_uu_ 4        RVn        RRR4       R#   + '       g   i     R# ; i)r   V瞯<atolrtolfooN)	_make_random_splinetckr   r4   r5   r6   pytestr   AttributeError)rS   rV   ra   s   &  rW   test_tckTestBSpline.test_tckX   sz    !eeSV%e<SV%e<ssc!f}} ]]>**AE +***s   B%%B6	c                   \        VP                  . RO4      VP                  R^.4      ^ R7      pVP                  ^ ^^
4      pVP                  VR8  VP                  RVP                  R7      R4      p\        V! V4      V4       R# )r   r2   rE   r3   r;   rF   Nr   r2   r?   )r   rQ   linspacewhererP   r   )rS   rT   rV   xxexpecteds   &&   rW   test_call_namespaceTestBSpline.test_call_namespaced   so     bjj,

B70CqI[[Ar"88BGRZZ"**Z%EsK"x(    c                    \        VP                  . RO4      VP                  R^.4      ^ R7      p\        VP                  4      VJ g   Q h\        VP                  4      VJ g   Q hR# )r   rE   r3   Nrg   )r   rQ   r
   r4   r5   rS   rT   rV   s   && rW   &test_attributes_have_correct_namespace2TestBSpline.test_attributes_have_correct_namespacem   sT    bjj,

B70CqIqss#r)))qss#r)))rn   c                ,   \         P                  ! ^ ^^
4      p\        ^ ^.R.^ R7      p\        V! V4      \         P                  ! V4      R,          4       \        . RO^^.^ R7      p\        V! V4      \         P
                  ! VR8  RR4      4       R# )r   rE   r3   ffffff?rF   N)r   rt   r0   )rK   rh   r   r   	ones_likeri   )rS   rj   rV   s   &  rW   test_degree_0TestBSpline.test_degree_0r   su    [[Ar"q!f*"r||B/#56lq!f2"rxxT	3<=rn   c           
     *   VP                  . RO4      pVP                  . R	O4      p^p\        W#V4      pVP                  RR^2VP                  R7      p\	        V! V4      V^ ,          \        WaR7      ,          V^,          \        V^,
          VR7      ,          ,           V^,          \        V^,
          VR7      ,          ,           RR7       \        \        WbV34      w  rxp	\        WxW34      p
\	        V! V4      VP                  V
4      RR7       R# )
r   r2   rE   r;   rT   +=r]   Nr@   )r2   r?   rA   )	rQ   r   rh   rP   r   B_012mapr	   r   )rS   rT   r4   r5   r6   rV   xx_npt_npc_npsplev_results   &&         rW   test_degree_1TestBSpline.test_degree_1{   s    JJ'JJ{#A!KKS"BJJK7aDaDq 1Q4acb(9#99AaDqsrAR<RR	

 01)<DT$?3!bjj6UCrn   c           
        ^pVP                  ^ .V^,           ,          ^.V^,           ,          ,           4      pVP                  . RO4      p\        \        VP                  VR4      4      \        VP                  ^ ^.4      4      4      p\	        W4V4      pVP                  R	R^
4      p\        V! VRR7      VP                  V! \        V4      RR7      4      RR7       R# )
rA   rD   Textrapolaterz   r{   Nr2   rD   rE   rF   )r=   r0   g      )rQ   r   r	   reshaper   rh   r   )rS   rT   r6   r4   r5   bpbsplrj   s   &&      rW   test_bernsteinTestBSpline.test_bernstein   s    JJsAaCyA3!9,-JJ'(bjjG45bjj!Q01
 qQ[[b"%&JJr+B/TBC	
rn   z
dask.arrayz"_naive_eval is not dask-compatiblereasonz	jax.numpyztoo slow; XXX a slow-if marker?torchz	OOB on CIc                   \        VR 7      pVP                  w  r4pVP                  W5,          W5) ^,
          ,          ^24      pV! V4      pTP                  V Uu. uF  p\	        WWEVR 7      NK  	  up4      p	\        WyRR7       TP                  V Uu. uF  p\        WWEVR 7      NK  	  up4      p
\        WzRR7       R# u upi u upi )ry   rz   r{   N)r`   ra   rh   stack_naive_evalr   _naive_eval_2)rS   rT   rV   r4   r5   r6   rj   y_br~   y_ny_n2s   &&         rW   test_rndm_naive_eval TestBSpline.test_rndm_naive_eval   s      2&%%a[[qAw+ehhC1A!26CDu-xx2F2aqQb92FG.	 D Gs   CCc           	         \        4       pVP                  w  r#p\        P                  ! W$,          W$) ^,
          ,          ^24      p\	        V! V4      \        WRW434      RR7       R# r0   rz   r{   N)r`   ra   rK   rh   r   r   rS   rV   r4   r5   r6   rj   s   &     rW   test_rndm_splevTestBSpline.test_rndm_splev   sL    !%%a[[qAw+"uRQ3%@rn   c                   \         P                  P                  R 4      p\         P                  ! VP                  ^4      4      pVP                  ^4      p\	        W#4      p\        V!  pVP                  VP                  rv\         P                  ! Wg,          Wg) ^,
          ,          ^P4      p\        V! V4      \        W4      RR7       R# )  rz   r{   N)rK   rR   RandomStatesortr   r   r4   r6   rh   r   r   )	rS   rngr~   yra   rV   r4   r6   rj   s	   &        rW   test_rndm_splrepTestBSpline.test_rndm_splrep   s    ii##D)GGCJJrN#JJrNQlSMssACC1[[qAw+"uR~E:rn   c                Z   \        VR 7      pVP                  VP                  4      Vn        VP                  VP                  VP
                  ,          VP                  VP
                  ) ^,
          ,          ^dVP                  R7      p\        V! V4      VP                  V4      4       R# )ry   r;   N)r`   ru   r5   rh   r4   r6   rP   r   )rS   rT   rV   rj   s   &&  rW   test_rndm_unityTestBSpline.test_rndm_unity   so    2&ll133[[QSS133tAv;2::[F"r||B/0rn   c                   \         P                  P                  R 4      p^^rC\         P                  ! VP                  V4      4      pVP                  V^^3R7      p\	        VP
                  WV34      w  rV\        WVV4      pWT,          WT) ^,
          ,          rWV,
          VP                  VP                  R4      4      ,          ,           p
V! V
4      P                  R8X  g   Q hR# )r   sizeNrA   rB      )rA   rB   r         )rK   rR   r   r   r}   rQ   r   shape)rS   rT   r   rU   r6   r4   r5   rV   tmtprj   s   &&         rW   test_vectorizationTestBSpline.test_vectorization   s    ii##D)11GGCJJqM"JJQ1IJ&2::v&A!qAwB7bjjI)>???u{{o---rn   c           	        \         P                  P                  R 4      p^!^r2\         P                  ! VP                  W#,           ^,           4      4      pVP                  V4      p\         P                  WQP                  V^,           4      3,          p\        WEV4      \        WFV4      rVR,          V^ ,          ,
          p	\         P                  ! V^ ,          V	,
          VR,          V	,           ^24      p
\        V! V
4      V! V
4      RR7       \        V! V
4      \        WWS34      RR7       \        V! V
4      \        WWc34      RR7       R# )r   rz   r{   Nr=   )	rK   rR   r   r   r_r   rh   r   r   )rS   r   rU   r6   r4   r5   c_padrV   b_paddtrj   s   &          rW   
test_len_cTestBSpline.test_len_c   s     ii##D)11GGCJJqs1u%&JJqM aAaC()1#WQq%95rUQqT\[[1AbEBJ3"uRyu5"uRQ3%@"uRU7eDrn   c           	         \        4       pVP                  w  r4pW5,          W5) ^,
          ,          rvR F1  p\        V! Wg.V4      V! VR,           VR,
          .V4      RRR7       K3  	  R# )r0   绽|=&.>Hz>r\   NTFr`   ra   r   )	rS   num_parallel_threadsrV   r4   _r6   r   r   extraps	   &&       rW   test_endpointsTestBSpline.test_endpoints   sb    !%%aqAwB#FArh/rEz2:6?dQUW $rn   c           	         \        4       pVP                  w  r4p\        V! W5^,           V) ^,
           R,
          4      V! W5^,           V) ^,
           R,           4      RR7       R# )r0   r   r   r{   Nr   )rS   r   rV   r4   r   r6   s   &&    rW   test_continuityTestBSpline.test_continuity   sV    !%%a!aC1+-.!aC1+2E0F	rn   c                   \        VR 7      pVP                  w  r4pVR,          V^ ,          ,
          pVP                  W5,          V,
          W5) ^,
          ,          V,           ^24      pW5,          V8  WsV) ^,
          ,          8  ,          p\        V! Wx,          RR7      V! Wx,          RR7      4       \	        \
        WsV34      w  rpVP                  \        WW3^ R7      4      p\        V! VRR7      V4       R# )ry   Tr   F)extNr=   )r`   ra   rh   r   r}   r	   rQ   r   )rS   rT   rV   r4   r5   r6   r   rj   maskxx_npr   r   r   s   &&           rW   test_extrapTestBSpline.test_extrap   s    2&%%arUQqT\[[AbdGbL"5r	baRT7l+ 	"(5"(6	8   1B1:>Tzz%dA"FG"$/>rn   c                    \        4       pVP                  w  r#pV^ ,          ^,
          VR,          ^,           .pV! V4      p\        P                  ! \        P                  ! V4      4      '       d   Q hR# )r   Nr=   )r`   ra   rK   allisnan)rS   rV   r4   r   r6   rj   yys   &      rW   test_default_extrapTestBSpline.test_default_extrap  sZ    !%%adQh"	"rU66"((2,'''''rn   c                    \         P                  P                  R 4      p\         P                  ! VP                  ^4      4      pVP                  ^4      p\	        VP
                  W434      w  r4^p\        W4VRR7      pVP                  ^ ,          V^,           ,
          pVR
,          V^ ,          ,
          pVP                  W5,          V,
          W7,          V,           ^24      p	W5,          WV,          ,
          W7,          W5,          ,
          ,          ,           p
\	        \        WV34      w  rp\        V4      VP                  8X  d   RMRp\        V! V	4      VP                  \        WW34      4      VR7       VP                  . RO4      p	W5,          WV,          ,
          W7,          W5,          ,
          ,          ,           p
\        V! V	RR7      V! V
RR7      \        V4      VP                  8X  d   RMRR7       R	# )r   periodicr   -q=gH׊>r{   Trz   gƠ>Nr=   )r=   r         ?r0   )rK   rR   r   r   r}   rQ   r   r   rh   r	   r   rP   r   r   )rS   rT   r   r4   r5   r6   rV   rU   r   rj   xyxy_npr   r   r]   s   &&             rW   test_periodic_extrap TestBSpline.test_periodic_extrap  sv   ii##D)GGCJJqM"JJqM2::v&A!4GGAJ!a% rUQqT\[[AD2Ir2TRA$Y14!$;// 1B1:>T(,

:ubE2::eE$?;<4	

 ZZ(TRA$Y14!$;//bj)bd#*2."**<$	
rn   c                    \        4       pVP                  w  r#p\        P                  ! W#V34      p\        P
                  ! W$,          W$) ,          ^d4      p\        V! V4      V! V4      RRR7       R# )d   rz   r\   N)r`   ra   r   from_splinerK   rh   r   )rS   rV   r4   r5   r6   pprj   s   &      rW   
test_ppolyTestBSpline.test_ppoly'  sY    !%%aay)[[quc*"r"vE>rn   c           	        \        4       pVP                  w  r#p\        P                  ! V^ ,          VR,          ^24      p\        P                  WR3,          p\        ^V^,           4       F&  p\        WRW43VR7      p\        Wq! WVR7      RR7       K(  	  \        V! WT^,           R7      \        P                  ! V4      RR7       R# )r   dernurz   r{   Nr=   )	r`   ra   rK   rh   r   ranger   r   
zeros_like)rS   rV   r4   r5   r6   rj   r   yds   &       rW   test_derivative_rndm TestBSpline.test_derivative_rndm/  s    !%%a[[1qub)UU25\AaC=Crq9#.BB"E: !
 	"1r}}R'8uErn   c                \   ^p. ROp\         P                  P                  R4      p\         P                  ^ ^ VP                  ^4      ^ ^ 3,          p\	        W$V4      p\         P
                  ! . RO4      p\        V! Wf^8g  ,          R,
          4      V! Wf^8g  ,          R,           4      4       \         P                  ! V! R4      V! R4      4      '       d   Q h\         P
                  ! ^^.4      p\        V! VR,
          ^R7      V! VR,           ^R7      4       \         P
                  ! ^^.4      p\         P                  ! V! VR,
          ^R7      V! VR,           ^R7      4      '       d   Q h\         P                  ! V! VR,
          ^R7      V! VR,           ^R7      4      '       d   Q hR# )	r?   r   r   r   N)r=   r=   r   r0   r0   rA   rB   r   r   r   r   r   )r0   rA   rB   r   g2H@gη   @)rK   rR   r   r   r   rQ   r   allclose)	rS   r6   r4   r   r5   rV   r~   x0x1s	   &        rW   test_derivative_jumps!TestBSpline.test_derivative_jumps<  sS    2ii##D)EE!Q

1q!+,A! JJ|$!F)e+,!F)e+,	.;;q{AgJ7777 ZZA"u*+"u*+	-ZZA;;qe2Ab5jQ4GHHHH ;;qUq11QY13EFFFFFrn   cupyzCuPy doesn't raisec           	         \        \        \        P                  3/ \	        VP                  ^ .4      R7      B  \        \        \        P                  3/ \	        VP                  . 4      R7      B  R# )r   r4   N)rG   rI   r   basis_elementrJ   rQ   rS   rT   s   &&rW   $test_basis_element_invalid_too_short0TestBSpline.test_basis_element_invalid_too_shortV  sJ     	j'"7"7S4"**aS/;RSj'"7"7R4"**R.;QRrn   c           	        VP                  R^^4      p\        P                  ! VP                  . R	O4      R7      p\	        \
        W#P                  VP                  34      w  rEpVP                  \        WEWcP                  34      4      p\        V! V4      VRR7       \        V4      VP                  8X  d   RMRp\        V! V4      VP                  \        V4      VP                  R7      VR7       \        P                  ! VP                  . R
O4      R7      pVP                  ^ ^^
VP                  R7      p\        V! V4      VP                  V^8  W",          RV,
          ^,          4      RR7       R# )r0   r   rz   r{   r   r;   rD   Nr=   r   r0   r?   rA   r   r0   r0   r?   )rh   r   r   rQ   r}   r	   r4   r5   r   r6   r   r   rP   B_0123ri   )	rS   rT   rj   rV   r   r   r   r   r]   s	   &&       rW   test_basis_element_quadratic(TestBSpline.test_basis_element_quadratic\  s   [[Q#!!BJJ|$<= 1BQSS>BTzz%dCC/@"AB"|%8&r*bjj8Ud"rzz&*BJJzGdS!!BJJ|$<=[[Ar[4"aB
3%	Arn   c           	         \        4       pVP                  w  r#p\        P                  ! W$,          W$) ^,
          ,          ^4      p\	        V! V4      \        WRW44      RR7       R# r   )r`   ra   rK   rh   r   _sum_basis_elementsr   s   &     rW   test_basis_element_rndm#TestBSpline.test_basis_element_rndml  sK    !%%a[[qAw+"22!?eLrn   c                   \        4       pVP                  w  r#pVR,          p\        W%V4      p\        W!P                  P                  V4      p\        W!P                  P
                  V4      p\        P                  ! W$,          W$) ^,
          ,          ^4      p\        V! V4      P                  V! V4      RR7       \        V! V4      P
                  V! V4      RR7       R# )r2   rz   r{   Ny      ?      @)	r`   ra   r   r5   realimagrK   rh   r   )	rS   rV   r4   r5   r6   ccb_reb_imrj   s	   &        rW   
test_cmplxTestBSpline.test_cmplxr  s    !%%a(^A1q##((A&q##((A&[[qAw+"

DH59"

DH59rn   c                    \         P                  ! VP                  . RO4      4      pVP                  V! VP                  4      4      '       g   Q hR# )r   Nr   )r   r   rQ   r   rM   rp   s   && rW   test_nanTestBSpline.test_nan  s8    !!"**\":;xx"&&	""""rn   c                    \        ^VR7      pVP                  w  r4p\        W4V4      pVP                  W5,          W5) ^,
          ,          ^4      p\	        ^V4       F.  pVP                  4       p\        V! Wx4      V! V4      RRR7       K0  	  R# )r   )r6   rT   r   r\   N)r`   ra   r   rh   r   
derivativer   )	rS   rT   rV   r4   r5   r6   b0rj   js	   &&       rW   test_derivative_method"TestBSpline.test_derivative_method  st    !+%%aQ1[[qAw+q!AABrIqu5uE rn   c                   \        VR 7      pVP                  w  r4pVP                  W5,          W5) ^,
          ,          ^4      p\        VP	                  4       P                  4       ! V4      V! V4      RRR7       VP                  WDV3^R7      pVP                  WD3^R7      p\        W4V4      p\        VP	                  4       P                  4       ! V4      V! V4      RRR7       R# )ry   rz   r\   axisN)r`   ra   rh   r   antiderivativer  r   r   )rS   rT   rV   r4   r5   r6   rj   s   &&     rW   test_antiderivative_method&TestBSpline.test_antiderivative_method  s    2&%%a[[qAw+((*557;"E	7 HHaAYQH'HHaV!H$A!((*557;"E	7rn   c                   \         P                  ! VP                  . R	O4      4      p\        P                  ! VP                  ^ ^4      RRR7      '       g   Q h\        P                  ! VP                  ^^ 4      RRR7      '       g   Q h\        P                  ! VP                  ^^ 4      RRR7      '       g   Q h\        P                  ! VP                  ^ ^4      RRR7      '       g   Q h\        P                  ! VP                  ^^ 4      RRR7      '       g   Q h\        P                  ! VP                  ^^ 4      RRR7      '       g   Q h\        P                  ! VP                  R
^4      RRR7      '       g   Q h\        P                  ! VP                  R
^RR7      RRR7      '       g   Q h\        P                  ! VP                  R
^RR7      RRR7      '       g   Q h\        P                  ! VP                  ^R
RR7      RRR7      '       g   Q h\        P                  ! VP                  ^R
RR7      \        P                  ! ^R
\        \        VP                  4      4      RR7      '       g   Q hR# )r   r   rz   abs_tolrC   Tr   FNr>   r=         )r   r   rQ   mathisclose	integrate_implr   r}   r	   ra   rp   s   && rW   test_integralTestBSpline.test_integral  s   !!"**Y"78||AKK1-sEBBBB||AKK1-xGGGG||AKK1-tUCCCC ||AKK1-sEBBBB||AKK1-xGGGG||AKK1-tUCCCC ||AKKA.UCCCC||AKKA4K@#uUUUU||AKKA5KA3PUVVVV||AKK25KA4QVWWWW ||AKK25KA!LLB4Equu0MN$)+ + 	+ +rn   z(CuPy periodic extrapolation seems brokenc           	        \         P                  ! VP                  . RO4      4      pRVn        VP	                  4       pVP                  V! ^4      V! ^ 4      ,
          VP
                  R7      p\        P                  ! VP                  ^ ^4      V4      '       g   Q h\        P                  ! VP                  ^^ 4      RV,          4      '       g   Q h\        P                  ! VP                  RR	4      V4      '       g   Q h\        P                  ! VP                  R
R4      ^V,          4      '       g   Q h\        VP                  RR4      VP                  V! R4      V! R4      ,
          4      4       \        VP                  R^4      VP                  V! ^4      V! ^ 4      ,
          V! ^4      ,           V! R4      ,
          4      4       \        VP                  R^4      VP                  V! ^4      V! ^ 4      ,
          V! ^4      ,           V! R4      ,
          4      4       \        VP                  R^4      VP                  V! ^4      V! ^ 4      ,
          V! ^4      ,           V! R4      ,
          ^V,          ,           4      4       \        VP                  ^ R4      VP                  V! ^ 4      V! ^4      ,
          4      4       \        VP                  RR4      VP                  V! ^ 4      V! ^4      ,
          4      4       \        VP                  ^ R4      VP                  V! ^4      V! ^4      ,
          ^V,          ,
          4      4       R# )r   r   r;   r         ?Nr>   r=   iiig      +@i)
r   r   rQ   r   r  rP   r!  r"  r#  r   )rS   rT   rV   i
period_ints   &&   rW   test_integral_periodic"TestBSpline.test_integral_periodic  sg    !!"**Y"78"ZZ!qt2::Z>
||AKK1-z::::||AKK1-rJ????||AKKB/<<<<||AKKB/Z@@@@C-

1S6AcF?3	5C+

1Q4!A$;1#5##>?	AHf5

1Q4!A$;1#5##>?	AC0

1Q4!A$;1#5##>Z#OP	R 	Ar*BJJqtad{,CDB,bjj1!.EFAr*

1Q4!A$;Z#?@	Brn   c                    . ROp\        W4      pRVn        \        P                  ! V4      pR F/  w  rE\	        VP                  WE4      VP                  WE4      4       K1  	  R# )r   r   Nr@   ))r   )r   r   )r)     )r   r   r   r   r   r#  )rS   r~   rV   pr   r   s   &     rW   test_integrate_ppoly TestBSpline.test_integrate_ppoly  sS    q$"a 5FBAKK/KK/1 6rn   c                    \         P                  ! . RO4      pR FL  pVP                  ^ ^VR7      p\        V\        P
                  4      '       g   Q hVP                  ^ 8X  d   KL  Q h	  R# )r   r   Nr>   r   )r   r   r#  
isinstancerK   ndarrayndim)rS   rV   r   ress   &   rW   test_integrate_0D_always$TestBSpline.test_integrate_0D_always  sW    !!),(K++a+<Cc2::....88q= = )rn   c                     ! R  R\         4      pVP                  . RO4      pVP                  V8X  g   Q hVP                  4       P                  V8X  g   Q hVP	                  4       P                  V8X  g   Q hR# )c                       ] tR tRtRtR# )'TestBSpline.test_subclassing.<locals>.Bi   N)__name__
__module____qualname____firstlineno____static_attributes__r>  rn   rW   Br=    s    rn   rD  N)r   r0   r?   r?   )r   r   	__class__r  r  )rS   rD  rV   s   &  rW   test_subclassingTestBSpline.test_subclassing  sg    	 	 OOL){{a||~''1,,,!++q000rn   r  c                   ^^rCVP                  ^ ^W4,           ^,           4      p. ROpV^,          pVP                  Ws4       \        V4      p\        P                  P                  R4      pVP                  VP	                  VR7      4      p	\        WYWAR7      p
V
P                  P                  Wg,          3VRV ,           Wg^,           R ,           8X  g   Q hVP	                  R4      pV
! V4      P                  VRV VP                  ,           Wg^,           R ,           8X  g   Q hV	P                  ) ^,
          V	P                  3 F#  p\        \        \        3/ \        WYWKR7      B  K%  	  \        WYWAR7      P                  4       \        WYWAR7      P                  ^4      \        WYWAR7      P                  4       \        WYWAR7      P                  ^4      3 F   pVP                   V
P                   8X  d   K   Q h	  R# )   r   r   r  N)r4   r5   r6   r  r   r      r   )rh   r   tuplerK   rR   r   rQ   r   r5   r   r7  rG   r'   rJ   r  r  r  )rS   r  rT   rU   r6   r4   shpos_axisr   r5   rV   axb1s   &&&          rW   	test_axisTestBSpline.test_axis  s   11KK1aeai( !8
		(2Yii##D)JJszzrz*+A!'ssyyR\Ob(m;b!oMMMMZZ	"u{{b(mbhh6QJKHHHH FF7Q;'B)W : 1Q8: (
 1.99;1.99!<1.==?1.==a@BB 77aff$$$	Brn   c           	     $   ^pVP                  . RO4      pVP                  . RO. RO.4      p\        W4VRR7      p\        W4R,          V4      p\        W4R	,          V4      p\        V! R4      VP                  V! R4      V! R4      .4      4       R# )
r?   r  r:   N)r   r0   r?   rA   rB   r   r   r=   )r=   r?   r   r=   )r?   r   r0   )r   NNN)r0   rU  )rQ   r   r   r   )rS   rT   r6   r4   r5   splspl0spl1s   &&      rW   test_neg_axisTestBSpline.test_neg_axis  s{    JJ,-JJ67aAB'qD'1%qD'1%C"((DItCy+A"BCrn   c                    R p^p^pR F  pV! W#V4       K  	  \        ^^^4       F  pV! W#R4       K  	  ^p\        ^^4       F  pV! W#R4       K  	  R# )a  
Splines with different boundary conditions are built on different
types of vectors of knots. As far as design matrix depends only on
vector of knots, `k` and `x` it is useful to make tests for different
boundary conditions (and as following different vectors of knots).
c                   \         P                  P                  R4      p\         P                  ! VP	                  V 4      ^(,          ^,
          4      pVP	                  V 4      ^(,          ^,
          pVR8X  d   VR,          V^ &   \        WEWR7      p\         P                  ! \        VP                  4      V,
          ^,
          4      p\        VP                  Wq4      ! V4      p\        P                  ! VVP                  V4      P                  4       p	\        WP                  ,          VRR7       \        WRR7       R# )zA
To avoid repetition of code the following function is provided.
r   r   r6   bc_typerz   r{   Nr=   )rK   rR   r   r   random_sampler   eyelenr4   r   design_matrixtoarrayr   r5   )
rU   r6   r^  r   r~   r   r   r5   des_matr_defdes_matr_csrs
   &&&       rW   run_design_matrix_testsHTestBSpline.test_design_matrix_bc_types.<locals>.run_design_matrix_tests  s     ))''-C))!,r1B67A!!!$r)B.A*$u!%aaADs466{Q*+A"466103L"00151244;GI  L66115ALUCrn   
not-a-knotr   Nclampednatural)r   )rS   rf  rU   r6   bcs   &    rW   test_design_matrix_bc_types'TestBSpline.test_design_matrix_bc_types  sg    	D* (B#A"- ) q!QA#A,7   q!A#A*5 rn   r   degreec           	     X   \         P                  P                  R4      pVP                  ^
V^,           ,          4      p\         P                  ! V4      \         P
                  ! V4      reTp\         P                  \         P                  ! V^,
          V^,
          V4      \         P                  ! WV^V^,           ,          4      \         P                  ! V^,           V^,           V4      3,          p\         P                  ! \        V4      V,
          ^,
          4      p	\        WWq4      p
\        V
! V4      \        P                  ! WHWq4      P                  4       4       \         P                  ! V^
,
          V^,
          VR,           V^
,           .4      pV'       gE   \        P                   ! \"        4      ;_uu_ 4        \        P                  ! WHWq4       RRR4       R# \        V
! V4      \        P                  ! WHWq4      P                  4       4       R#   + '       g   i     R# ; i)z;Test that design_matrix(x) is equivalent to BSpline(..)(x).r   r(  N)rK   rR   r   r_  aminamaxr   rh   r`  ra  r   r   rb  rc  arrayrb   r   rI   )rS   r   ro  r   r~   xminxmaxr6   r4   r5   bsplines   &&&        rW   'test_design_matrix_same_as_BSpline_call3TestBSpline.test_design_matrix_same_as_BSpline_call;  s~    ii##D)bFQJ/0WWQZdEE"++dQhq&9++d!vz*:;++dQhq&9: ; FF3q6A:>"!/AJ--aACKKM	

 HHdRi4#:tbyABz**%%aA; +* 
%%aA;CCE +**s   ?HH)	c                   \         P                  P                  R 4      p^
p^p\         P                  ! VP	                  V4      ^(,          ^,
          4      pVP	                  V4      ^(,          ^,
          p\        WEVR7      p\        ^^4       F[  pVRV pVRV p	\        P                  ! VVP                  V4      P                  4       p
\        WP                  ,          V	RR7       K]  	  R# )r   r6   Nrz   r{   )rK   rR   r   r   r_  r   r   r   rb  r4   rc  r   r5   )rS   r   rU   r6   r~   r   r   r*  xcycre  s   &          rW   test_design_matrix_x_shapes'TestBSpline.test_design_matrix_x_shapesW  s    ii##D)GGC%%a(2-23a 2%*!!!,q!A2AB2AB"00151244;GI  L6612EB rn   c                |    . ROp\         P                  ! RV^4      P                  4       p\        V. RO.RR7       R# )r2   rD   rz   r{   N)r2   r2   r2   rD   rE   rF   rF   rF   )g      ?gmਪ?gK}\UU?rC   )r   rb  rc  r   )rS   r4   des_matrs   &  rW   test_design_matrix_t_shapes'TestBSpline.test_design_matrix_t_shapesh  s7    ,((Q2::<;<"	$rn   c           	     p   \         P                  P                  R 4      p^
p^p\         P                  ! VP	                  V4      ^(,          ^,
          4      pVP	                  V4      ^(,          ^,
          p\        WEVR7      p\        \        4      ;_uu_ 4        \        P                  ! WFP                  RRR1,          V4       RRR4       ^p. ROp. ROp\        \        4      ;_uu_ 4        \        P                  ! WGV4       RRR4       R#   + '       g   i     LS; i  + '       g   i     R# ; i)r   rz  Nr=   )rC   r2   rD   rE   rF         @r   )rK   rR   r   r   r_  r   rG   rI   r   rb  r4   )rS   r   rU   r6   r~   r   r   r4   s   &       rW   test_design_matrix_asserts&TestBSpline.test_design_matrix_assertsp  s    ii##D)GGC%%a(2-23a 2%*!!!, :&&!!!VVDbD\15 '$:&&!!!* '& '& '&&s   ,D/D$D!	$D5	r^  c                   \         P                  P                  R 4      p\         P                  ! VP                  ^4      4      pVP                  ^4      pVR8X  d   V^ ,          VR&   \	        W4VR7      p\
        P                  ! WQR7      p\         P                  ! ^ ^^4      p\        V! V4      V! V4      RR7       \        W4VR7      p\        VP                  VP                  RR7       R# )r   r   r^  r[   r{   Nr=   )rK   rR   r   r   r   r   from_power_basisrh   r   r   r5   )	rS   r^  r   r~   r   cbr   rj   bspl_news	   &&       rW   test_from_power_basis!TestBSpline.test_from_power_basis  s     ii##D)GGCJJrN#JJrNj aDAbEw/''<[[Ar"2Ru5%aG<

7rn   c                (   \         P                  P                  R 4      p\         P                  ! VP                  ^4      4      pVP                  ^4      VP                  ^4      R,          ,           pVR8X  d   V^ ,          VR&   \	        W4VR7      p\
        P                  ! WQR7      p\        W4P                  VR7      p\        W4P                  VR7      p\        VP                  VP                  RVP                  ,          ,           RR7       R# )r   r1   r   r  r[   r{   Nr=   )rK   rR   r   r   r   r   r  r   r  r  r   r5   )	rS   r^  r   r~   r   r  r   bspl_new_realbspl_new_imags	   &&       rW   test_from_power_basis_complex)TestBSpline.test_from_power_basis_complex  s     ii##D)GGCJJrN#JJrNSZZ^b00j aDAbEw/''<*1ffgF*1ffgF"}2F FUSrn   c                    \         P                  ! . RO4      p\         P                  ! . RO4      p\        P                  ! \	        WRR7      RR7      p\        VP                  . RORR7       R# )	a5  
For x = [0, 1, 2, 3, 4] and y = [1, 1, 1, 1, 1]
the coefficients of Cubic Spline in the power basis:

$[[0, 0, 0, 0, 0],\$
$[0, 0, 0, 0, 0],\$
$[0, 0, 0, 0, 0],\$
$[1, 1, 1, 1, 1]]$

It could be shown explicitly that coefficients of the interpolating
function in B-spline basis are c = [1, 1, 1, 1, 1, 1, 1]
rk  r  r[   r{   Nr@   )r0   r0   r0   r0   r0   )r2   r0   r0   r0   r0   r0   r0   )rK   rs  r   r  r   r   r5   )rS   r~   r   r   s   &   rW   test_from_power_basis_exmp&TestBSpline.test_from_power_basis_exmp  sM     HH_%HH_%''A)(L09; 7eDrn   c                t   \         P                  ! ^ ^.4      p\         P                  ! R.4      pVP                  RR7       VP                  RR7       \         P                  ! ^ ^^
4      pVP                  RR7       \	        W^ R7      p\        V! V4      \         P                  ! V4      R,          4       R# )r   rE   Fwriter3   N)rK   rs  setflagsrh   r   r   ru   )rS   r4   r5   rj   rV   s   &    rW   test_read_onlyTestBSpline.test_read_only  s    HHaVHHcUO	


	


[[Ar"
% a""r||B/#56rn   c                D   a \        SR 7      pV3R lp\        ^
W24       R# )ry   c                    < VP                   w  r pSP                  W#,          W#) ^,
          ,          R4      pV! V4       R# )r0   i'  N)ra   rh   )r   rV   r4   r6   rj   rT   s   &&   rW   	worker_fn/TestBSpline.test_concurrency.<locals>.worker_fn  s3    eeGA!QT1RT7E2BbErn   N)r`   r(   )rS   rT   rV   r  s   &f  rW   test_concurrencyTestBSpline.test_concurrency  s    2&	
 	 I1rn   cygwinz'threading.get_native_id not implemented)r   r   c           	     t   \        4       p\        P                  ! ^ ^^
4      pV! V4      p\        P                  ! 4       p\        P
                  ! \        VP                  RV R24      4      RVP                  P                  VP                  P                  R7      pVP                  VR&   \        P
                  ! \        VP                  RV R24      4      RVP                  P                  VP                  P                  R7      pVP                  VR&   Wbn        Wrn        \        V! V4      V4       R# )r   r4   z.datzw+)moder<   r   rU  r5   N)r`   rK   rh   	threadingget_native_idmemmapstrjoinr4   r<   r   r5   r   )rS   tmpdirrV   rj   rk   tidt_mmc_mms   &&      rW   test_memmapTestBSpline.test_memmap  s      ![[Ar"R5%%'yyV[[1SE78t ssyy		;##QyyV[[1SE78t ssyy		;##Q"x(rn   r>  Nr)  )FTr   )rk  rj  r   rh  )>r?  r@  rA  rB  rX   rd   rl   rq   rv   r   r   skip_xp_backendsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r%  xfail_xp_backendsr,  r2  r9  rF  rb   markparametrizer   rQ  rY  rm  rw  r}  r  r  r  r  r  r  r  xfailsysplatformrc   r  rC  __classdictcell____classdict__s   @rW   r.   r.   2   sP    !F
)*
>D 
$ l+OPk*KLgk2/ 3 M Q/A
;1	.E&W? (
6?FG4 f%9:S ;S
A M:#
F7+, v&PQB RB4	1!1 [[VU2q\2% 3%:D(6T [[],EF[[XuQx0 1 G4C"$+$ [[Y )C D8D8 [[Y )C DTDTE&7	2 [[ 8  
)
)rn   r.   insert_knotc                   R  a  ] tR tRt o ]P
                  P                  R. RO4      R 4       t]P
                  P                  R. RO4      R 4       tR t	]P
                  P                  R. RO4      R 4       t
]P
                  P                  R	R
R.4      R 4       tR tR tRtV tR
# )
TestInserti  xvalc           	     4   VP                  ^VP                  R7      pVP                  V4      ^,          p\        W4^R7      p\	        VP
                  4      \	        VP                  4      VP                  3p\        \        W4      !  pVP                  V4      p\        VP
                  VP                  VP
                  4      RR7       \        VP                  VP                  VP                  RVP                  ) ^,
           4      RR7       WR	,          8w  d   TMVRR	 p	VP                  V	RVR,          VRR	 ,           ,          34      p	\        V! V	4      V! V	4      RR7       VP                  V4      ^,          p
\        W:^R7      p\        W2P                  WJ3^R7      ^R7      pVP                  V4      p\        VP
                  VP
                  RR7       \        VP                  VP                  VP                  V4      P                  VP                  V4      P                  3^R7      RR7       WR	,          8w  d   TMVRR	 p	VP                  V	RVR,          VRR	 ,           ,          34      p	\        V! V	4      V! V	4      RR7       R# )
rK  r;   rz  r[   r{   Nr   r0   NNr  r=   )rO   rP   sinr   r	   r4   r5   r6   r   r   r  r   rQ   concatcosr   )rS   r  rT   r~   r   rV  ra   spl_1fspl_1rj   y1spl_y1spl_yyspl_yy1s   &&&           rW   test_insertTestInsert.test_insert  s
    IIarzzI*FF1IqL + '):355)A355I&+,%FHH!5EBFHHYsuufQh,?!@uM B%-QQsVYYC23B012Br7 VVAY\#AQ/#Axxax'@AF$$T*		5777IIHHcood+--v/A/A$/G/I/IJQRHS	
 B%-QQsVYYC23B012r
GBKe<rn   zxval, mc           	        VP                  ^VP                  R7      pVP                  V4      ^,          p\        WE^R7      p\	        \        V\        VP                  4      \        VP                  4      VP                  3VR7      !  pVP                  W4      p\        VP                  VP                  VP                  4      RR7       \        VP                  VP                  VP                  RVP                  ) ^,
           4      RR7       WR	,          8w  d   TMVRR	 p	VP                  V	RVR,          VRR	 ,           ,          34      p	\        V! V	4      V! V	4      RR7       R# )
rK  r;   rz  mr[   r{   Nr   r  r=   )rO   rP   r  r   r   r   r	   r4   r5   r6   r  r   rQ   r  )
rS   r  r  rT   r~   r   rV  r  r  rj   s
   &&&&      rW   test_insert_multiTestInsert.test_insert_multi  s    IIarzzI*FF1IqL +(/1B3551I355QUV

 (FHH!5EBFHHYsuufQh,?!@uMB%-QQsVYYC23B012Br7rn   c                z   \         P                  P                  R 4      p^^rCVP                  \         P                  ! VP                  W4,           ^,           R7      4      4      pVP                  VP                  V^^3R7      4      p\        WVV4      pVP                  VP                  WT^,           ,          WT) ^,
          ,          R7      4      pVP                  V4      p	VP                  VP                  WT^,           ,          WT) ^,
          ,          ^!R7      4      p
\        V! V
4      V	! V
4      RR7       R# )90  r   )lowhighr  r  r   r[   r{   N)	rK   rR   default_rngrQ   r   uniformr   r  r   )rS   rT   r   rU   r6   r4   r5   rV  xvr  rj   s   &&         rW   test_insert_randomTestInsert.test_insert_random(  s    ii##E*11JJrwws{{A{678JJs{{Aq	{23aAZZA#Qr!tW=>#ZZA#Qr!tW2FGBr7rn   r  c                   VP                  ^VP                  R7      pVP                  V4      ^,          p\        W4^R7      w  rVp\	        VP
                  WV34      w  rV\        WVVRR7      pVP                  V4      p	\        WP                  RR7      w  rp\        V	P                  VP                  V
4      RR7       \        V	P                  R	V) ^,
           VP                  VR	V) ^,
           4      RR7       \        P                  P                  R
4      P!                  ^ ^^)R7      pVP                  V4      p\        V	! V4      VP                  \#        WW34      4      RR7       R	# )rK  r;   rz  r   r   Tperr[   r{   Nr   r  )rO   rP   r  r   r}   rQ   r   r  r   ra   r   r4   r5   rK   rR   r  r  r   )rS   r  rT   r~   r   r4   r5   r6   rV  r  tfcfr   rj   s   &&&           rW   test_insert_periodicTestInsert.test_insert_periodic6  s    IIarzzI*FF1IqL#a2::v&aA:6#2wwD1	Be<!A

2er!t9(=EJ		%%d+333KZZb	2::eE;.G#HuUrn   r   Nr   c                   VP                  ^VP                  R7      ^,          \        P                  ,          pVP	                  V4      VP                  V4      rT\        W4RV,          ,           ^R7      pWn        \        W4^R7      pWn        \        W5^R7      pWn        Rp	VP                  V	4      p
VP                  V	4      pVP                  V	4      p\        V
P                  VP                  RR7       \        V
P                  VP                  RR7       \        V
P                  VP                  RVP                  ,          ,           RR7       R# )rK  r;   r1   rz        @r[   r{   N)rO   rP   rK   pir  r  r   r   r  r   r4   r5   )rS   r   rT   r~   y_rey_imrV  spl_respl_imr  r  spl_1respl_1ims   &&&          rW   test_complexTestInsert.test_complexJ  s    IIarzzI*Q.6VVAYq	d 2d7Na8%#Aq1(#Aq1(#$$R($$R(77R		\!9Frn   c                   R p^p\         P                  ! ^ .V^,           ,          . RO,           ^.V^,           ,          ,           4      p\         P                  ! \        V4      V,
          ^,
          4      p\	        W4VRR7      p\        \        4      ;_uu_ 4        \        WWB3RR7       RRR4       \        \        4      ;_uu_ 4        VP                  V4       RRR4       R#   + '       g   i     LC; i  + '       g   i     R# ; i)r  r   r   Tr  Nr?   rA   rB   r   )	rK   rs  onesra  r   rG   rI   r   r  )rS   r  r6   r4   r5   rV  s   &     rW   +test_insert_periodic_too_few_internal_knots6TestInsert.test_insert_periodic_too_few_internal_knotsa  s     HHaS!A#Y-QqS	9:GGCFQJN#aA:6:&&21yd+ ' :&&OOB '& '& '&&s   C&
C9&C6	9D
	c                   ^p\         P                  ! ^ .V^,           ,          . RO,           ^.V^,           ,          ,           4      p\         P                  ! \        V4      V,
          ^,
          4      p\	        W#V4      p\        \        4      ;_uu_ 4        VP                  R4       RRR4       \        \        4      ;_uu_ 4        VP                  ^4       RRR4       \        \        4      ;_uu_ 4        VP                  ^^ R7       RRR4       R#   + '       g   i     Lv; i  + '       g   i     LX; i  + '       g   i     R# ; i)rA   Nr  r  r=   )rK   rs  r  ra  r   rG   rI   r  )rS   r6   r4   r5   rV  s   &    rW   test_insert_no_extrap TestInsert.test_insert_no_extrapu  s    HHaS!A#Y-QqS	9:GGCFQJN#aA:&&OOB ' :&&OOA ' :&&OOAO# '& '& '& '&&s$   DD*9D=D'	*D:	=E	r>  )rC   r2   r:   rB         @      @))rC   r?   )r2   rA   )r(  r   )rB   r?   )r  r?   )	r   皙?rD   rF         @      @      @gffffff@r  )r?  r@  rA  rB  rb   r  r  r  r  r  r  r  r  r  rC  r  r  s   @rW   r  r    s      [[V%AB!= C!=H [[C88&8 [[T $8 VV" [[]T:,>?G @G, ($ $rn   r  c            
          RR lp R FY  p\        VR7      p\        \        V4      4       F2  w  r4V ! WC4       \        ^V^,           4       F  pV ! WCVRR4       K  	  K4  	  K[  	  R# )r   c           
      V   V P                   w  rVp\        P                  ! V4      p\        P                  V^ ,          R,
          RVR,          VR,          ,           ,          VR	,          R,           3,          p\	        \        WWg3V4      V ! W4      W4RV RV P                   2R7       R# )
r   r  r   r  :Nr0   Nzder = z  k = )r]   r^   err_msgNr=   )ra   rK   uniquer   r   r   r6   )	rV   r  r   r]   r^   r4   r5   r6   r~   s	   &&&&&    rW   check_splev,test_knots_multiplicity.<locals>.check_splev  s    %%aIIaLEE!A$s(C22/2s:;aQC0!A)se6!##.G	Irn   rz  r   N)r   rz   rz   r0   r?   rA   rB   r   )r`   	enumerate_make_multiplesr   )r  r6   rV   r  rP  r   s         rW   test_knots_multiplicityr    s^    I !$q12EAQ!}B3u5 % 3 rn   c                t   V^ 8X  d(   W2,          T u;8:  d   W2^,           ,          8  d   R#  R# W2V,           ,          W2,          8X  d   RpMHWV,          ,
          W2V,           ,          W2,          ,
          ,          \        W^,
          W#4      ,          pW2V,           ^,           ,          W2^,           ,          8X  d   RpWE,           # W2V,           ^,           ,          V ,
          W2V,           ^,           ,          W2^,           ,          ,
          ,          \        W^,
          V^,           V4      ,          pWE,           # )zk
Naive way to compute B-spline basis functions. Useful only for testing!
computes B(x; t[i],..., t[i+k+1])
r2   rC   _naive_Br~   r6   r*  r4   c1c2s   &&&&  rW   r  r    s    
 	Avda(!aC&(s1(c11v~A$hQ3!$'(1c1*@@1Qx1qS6 G !AhlQs1uXA#./(1c1Q32JJGrn   c               V  a aaaa S SS,          8X  d   SoMVP                  SS 4      ^,
          oSS,          S u;8:  d   SS^,           ,          8:  g   Q h Q hSS8  d    SSP                  ^ ,          S,
          8  g   Q h\        VVVVV 3R l\        ^ S^,           4       4       4      # )z5
Naive B-spline evaluation. Useful only for testing!
c              3   x   <"   T F/  pSSV,
          ,          \        SSSV,
          S4      ,          x  K1  	  R # 5iNr  ).0r  r5   r*  r6   r4   r~   s   & rW   	<genexpr>_naive_eval.<locals>.<genexpr>  s0     F1q1vAqsA...s   7:)searchsortedr   sumr   )r~   r4   r5   r6   rT   r*  s   ffff$@rW   r   r     s     	AaDyOOAq!A%Q41!A#6a!''!*q.(((FFa1FFFrn   c               &  a aaa SP                   ^ ,          S^,           ,
          pVS^,           8  g   Q hSP                   ^ ,          V8  g   Q hSS,          S u;8:  d   SV,          8:  g   Q h Q h\        VVVV 3R l\        V4       4       4      # )z'Naive B-spline evaluation, another way.c              3   \   <"   T F!  pSV,          \        SSVS4      ,          x  K#  	  R # 5ir  r  r  r*  r5   r6   r4   r~   s   & rW   r   _naive_eval_2.<locals>.<genexpr>  s(     =Hqqthq!Q***H   ),)r   r  r   )r~   r4   r5   r6   rT   rU   s   ffff$ rW   r   r     sr    	
acA!8O8771:??Q41!=E!H===rn   c                 `   \        V4      V^,           ,
          pWC^,           8  g   Q hVP                  ^ ,          V8  g   Q hRp\        V4       FZ  p\        P                  ! WWc,           ^,            RR7      ! V 4      pWRV,          \
        P                  ! V4      ,          ,          pK\  	  V# )r0   rC   Fr   )ra  r   r   r   r   rK   
nan_to_num)r~   r4   r5   r6   rU   sr*  rV   s   &&&&    rW   r  r    s    A!A#A!8O8771:??
A1X!!!ac!e*%@C	qTBMM!$$$  Hrn   c                    \         P                  ! \        V 4      4      p \         P                  ! W ^ 8  V ^8  ,          V ^ 8  V ^8  ,          V ^8  V ^8*  ,          .R R R .4      pVP	                  V4      # )z*A linear B-spline function B(x | 0, 1, 2).c                     R # rC   r>  r~   s   &rW   <lambda>B_012.<locals>.<lambda>  s    brn   c                     V # r  r>  r  s   &rW   r  r    s    Arn   c                     R V ,
          # rD   r>  r  s   &rW   r  r    s    Arn   )rK   
atleast_1dr	   	piecewiserQ   )r~   rT   results   && rW   r|   r|     sv    
'*+A\\!1uQ/!VA.!VQ/1 )+~FHF ::frn   c                    \         P                  ! \        V 4      4      p V ^8  V ^8  V ^8  ,          V ^8  .pV^ 8X  d
   R R R .pMV^8X  d
   R R R .pM\        RV 24      h\         P                  ! WV4      pV# )z0A quadratic B-spline function B(x | 0, 1, 2, 3).c                      W ,          R ,          # r"  r>  r  s   &rW   r  B_0123.<locals>.<lambda>  s
    13r6rn   c                 0    RV R,
          ^,          ,
          # )rE   g      ?r(  r>  r  s   &rW   r  r(    s    41T6A+-rn   c                 0    R V ,
          ^,          ^,          # )rE   r>  r  s   &rW   r  r(    s    BqD19q=rn   c                     R # r2   r>  r  s   &rW   r  r(        2rn   c                     R# )rD   g       r>  r  s   &rW   r  r(    s    3rn   c                     R # r,  r>  r  s   &rW   r  r(    r-  rn   znever be here: der=)rK   r#  r	   rI   r$  )r~   r   condsfuncspiecess   &&   rW   r   r     s    
'*+AUQUq1u%q1u-E
ax!-(* 
 .se455\\!E*FMrn   c                 6   \         P                  P                  ^{4      p\         P                  ! VP                  W,           ^,           4      4      pVP                  V 4      pVP	                  V4      VP	                  V4      rT\
        P                  ! WEV4      # ){   )rK   rR   r   r   rQ   r   construct_fast)rU   r6   rT   r   r4   r5   s   &&&   rW   r`   r`     sj    
))


$C


13q5!"A

1A::a="**Q-q!!!**rn   c              #    "   V P                   V P                  r!V P                  P                  4       pV^,          VR&   V^,          V^&   \	        W1V4      x  V P                  P                  4       pV^ ,          VRV^,           % \	        W1V4      x  V P                  P                  4       pVR,          W2) ^,
          R% \	        W1V4      x  R# 5i)zIncrease knot multiplicity.:      NNr=   )r5   r6   r4   copyr   )rV   r5   r6   t1s   &   rW   r  r    s     33q	
B2BuIVBrF
"
	
B!uBt!H
"
	
B2Br!tuI
"
s   CCc                   b   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tRtV tR# )TestInteropi  c                   \         P                  ! ^ R\         P                  ,          ^)4      p\         P                  ! V4      p\	        W4      pVP
                  VP                  VP                  3V n        WVuV n	        V n
        V n        \         P                  ! ^ R\         P                  ,          ^4      V n        \         P                  VP                  VP                  VP                  3,          p\         P                  ! WD34      V n        \!        VP
                  V P                  VP                  4      V n        R# )r   rF   N)rK   rh   r  r  r   r4   r5   r6   ra   rj   r   rV   xnewc_dstackr	  r   b2)rS   rj   r   rV   r	  s   &    rW   setup_methodTestInterop.setup_method	  s    [[BruuHb)VVBZr&CCacc?#%1 $&KK2bee8R0	UU133QSS=!))RH%!##tww,rn   c                .   V P                   V P                  V P                  r2p\        \	        W4      V! V4      R R R7       \        \	        WP
                  4      V! V4      R R R7       \        \        P                  ! V Uu. uF  p\	        WB4      NK  	  up4      V! V4      R R R7       \        \        RR7      ;_uu_ 4        \	        W4       RRR4       \        \        ^VP                  P                  4      4      R,           pVP                  P                  V4      pVP                  WcP                   3p\        \        P                  ! \	        W4      4      V! V4      P                  V4      R R R7       R# u upi   + '       g   i     L; i)r[   r\   zCalling splev.. with BSplinematchNr   )r>  rV   rA  r   r   ra   rK   rQ   rG   rI   rL  r   r5   r7  	transposer4   r6   )rS   r>  rV   rA  r~   rM  r	  ra   s   &       rW   
test_splevTestInterop.test_splev  s"   ii 	d$e%	9dEE*$e%	9

#>AE!K#>?$e%	9
 :-KLL$O M 5BDDII&'$.TT^^BttR

5#344**2.U	H $?
 MLs   E?FF	c                   V P                   V P                  r!\        W4      p\        P                  ! W4      w  rEp\	        V^ ,          VRR7       \	        V^,          VRR7       V^,          V8X  g   Q h\        WRR7      w  p  p\	        V^ ,          VRR7       \	        V^,          VRR7       V^,          V8X  g   Q h\        W4      p	\	        W)RR7       \        V!  p
\	        W*! V4      RR7       R# )r   r[   r{   T)full_outputN)rj   r   r   r$  r   r   r   )rS   r~   r   ra   r4   r5   r6   tck_fr   r   rV   s   &          rW   test_splrepTestInterop.test_splrep1  s    ww1Ql,,q$aA.A.1v{{  $7q!Qa!%0a!%0Qx1}} 1]E* SM1Q4e,rn   c                   V P                   V P                  r!\        P                  W"3,          p\	        \
        4      ;_uu_ 4        \        W4       R R R 4       \	        \
        4      ;_uu_ 4        \        P                  ! W4       R R R 4       \	        \        RR7      ;_uu_ 4        \        VR,          VR,          4       R R R 4       \	        \        RR7      ;_uu_ 4        \        P                  ! VR,          VR,          4       R R R 4       R #   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R # ; i)Nm > k must holdrE  :NrA   N)	rj   r   rK   r?  rG   rI   r   r$  rH   )rS   r~   r   y2s   &   rW   test_splrep_errorsTestInterop.test_splrep_errorsI  s     ww1UU14[:&&1M ':&&LL ' 9,=>>1R5!B%  ?9,=>>LL2"& ?> '&&& ?>>>>s0   D2D)*D<&&ED&	)D9	<E	E 	c                   \         P                  ! ^\         P                  R7      P                  R4      p\	        V4      w  r#\
        P                  ! V4      w  rE\        W5RR7       \        \         P                  ! \        W24      4      VRR7       \        \         P                  ! \        W44      4      VRR7       \	        V^ RR7      w  w  rg  p\        W7RR7       \        \         P                  ! \        Wv4      4      VRR7       R# )   r;   r[   r{   T)r  rL  NrA   r   )	rK   rO   rP   r   r   r$  r   rQ   r   )	rS   r~   rV   ura   u1b_fu_fr   s	   &        rW   test_splprepTestInterop.test_splprepY  s    IIb

+33F;qz--" 	E*

5;/?

5=115A &a1$?
Aq!U+

5?3QUCrn   c                p   \         P                  ! ^<4      P                  R4      p\        \        RR7      ;_uu_ 4        \        V4       RRR4       \        \        RR7      ;_uu_ 4        \        P
                  ! V4       RRR4       \         P                  ! ^ ^(^R7      p\        \        RR7      ;_uu_ 4        \        V.4       RRR4       \        \        RR7      ;_uu_ 4        \        P
                  ! V.4       RRR4       . ROp\        \        RR7      ;_uu_ 4        \        V.4       RRR4       \        \        RR7      ;_uu_ 4        \        P
                  ! V.4       RRR4       . R	Op. R
Op\        \        RR7      ;_uu_ 4        \        V.RV.!   RRR4       R#   + '       g   i     ELm; i  + '       g   i     ELI; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)rA   ztoo many values to unpackrE  N)numrQ  zError on input datar   ) >Ir`   >Kra  )r0   rA   r?   rB   )r   g333333?g?r0   )	rK   rO   r   rG   rI   r   r$  rh   rH   )rS   r~   rX  s   &  rW   test_splprep_errorsTestInterop.test_splprep_errorsh  si   IIe$$Y/:-HIIAJ J:-HIIMM! J KK21%9,=>>QCL ?9,=>>MM1# ?
 E:-BCCQCL D:-BCCMM1# D :-BCCqc4^$ DC/ JIIIII
 ?>>>> DCCC DCCsS   F/,G=G+G+(G>HH$/G 	G	G(	+G;	>H	H!	$H5	c                   V P                   V P                  r!\        P                  ! . R	O4      \        P                  ,          p\        \        V4      VRRR7       \        \        VP                  VP                  VP                  34      VRRR7       \        \        RR7      ;_uu_ 4        \        V^2R7       RRR4       VP                  P                  ^^^ 4      p\        P                  ! \        VP                  WBP                  3^2R7      4      pVP                  R
8X  g   Q h\        WS,
          \        P                  ! V4      RR7       R#   + '       g   i     L; i)r   r   r\   zCalling sproot.. with BSplinerE  )mestNr   r{   )r   r(  r:   r  )rA   r?   rB   )rV   rA  rK   rs  r  r   r   r4   r5   r6   rG   rI   rH  rQ   r   r   )rS   rV   rA  rootsc2rrrs   &     rW   test_sprootTestInterop.test_sproot  s    2-.ruu4q	5t$?QSS!##/TM :-LMM2B N ddnnQ1%ZZc440r:;xx9$$$
BMM"$5EB NMs   /EE&	c           	     l   V P                   V P                  r!\        \        ^ ^V4      \        ^ ^VP                  4      RRR7       \        \        ^ ^V4      VP                  ^ ^4      RRR7       \        \        RR7      ;_uu_ 4        \        ^ ^V4       RRR4       VP                  P                  ^^^ 4      p\        P                  ! \        ^ ^VP                  W2P                  34      4      pVP                  R8X  g   Q h\        V\        ^ ^V4      RRR7       R#   + '       g   i     L; i)	r   rz   F)r]   check_0dzCalling splint.. with BSplinerE  N)r]   check_shape)rA   r?   )rV   rA  r   r   ra   r#  rG   rI   r5   rH  rK   rQ   r4   r6   r   )rS   rV   rA  rg  integrs   &    rW   test_splintTestInterop.test_splint  s    2q!Qq!QUU+%%	Iq!QAq)	G :-LMM1a N ddnnQ1%F1a"$$TT):;<||v%%%q!Qe	H NMs   
D##D3	c                    V P                   V P                  3 EFp  p\        VP                  4      \        VP                  4      ,
          pVP                  P                  4       pV^ 8  dG   \        P                  V\        P                  ! V3VP                  R,          ,           4      3,          pR F  p\        V4      p\        P                  ! VP                  P                  4       W1P                  34      p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       VP                  V^,          8X  g   Q h\        V\        4      '       g   Q h\        V\         4      '       d   K  Q h	  EKs  	  R# r   r  r[   r{   Nr0   r?   rA   )rV   rA  ra  r4   r5   r9  rK   r   zerosr   r   r$  r6   r   r5  r   rL  rS   rV   ctb_crU   bdtck_ds   &      rW   test_splderTestInterop.test_splder  s   &&$''"AQSSCH$B##((*CAveeC2%#))B-*?!@@AAYacchhj#ss%;<eAhU;eAhU;ttuQx'''!"g....!%////  #rn   c                    V P                   V P                  3 EFp  p\        VP                  4      \        VP                  4      ,
          pVP                  P                  4       pV^ 8  dG   \        P                  V\        P                  ! V3VP                  R,          ,           4      3,          pR F  p\        V4      p\        P                  ! VP                  P                  4       W1P                  34      p\        VP                  V^ ,          RR7       \        VP                  V^,          RR7       VP                  V^,          8X  g   Q h\        V\        4      '       g   Q h\        V\         4      '       d   K  Q h	  EKs  	  R# rr  )rV   rA  ra  r4   r5   r9  rK   r   rt  r   r   r$  r6   r   r5  r   rL  ru  s   &      rW   test_splantiderTestInterop.test_splantider  s   &&$''"AQSSCH$B##((*CAveeC2%#))B-*?!@@A]((!##((*c33)?@eAhU;eAhU;ttuQx'''!"g....!%////  #rn   c                   V P                   V P                  V P                  r2pVP                  P                  ^,          pRVP                  V,          VP                  V^,           ,          ,           ,          p\        WQ4      \        WQP                  VP                  VP                  34      rv\        \        W64      \        W74      RR7       \        V\        4      '       g   Q h\        V\        4      '       g   Q h\        \        VP                  P                  4      4      pVP                  P                  VR,          R,           4      p	\        WRP                  WP                  34      p
\        WR4      p\        \         P"                  ! \        W:4      4      P                  ^^ ^4      V! V4      RR7       \        V\        4      '       g   Q h\        V
\        4      '       g   Q hR# )r?   r   r[   r{   r  NrG  )rV   rA  rj   r4   r   r   r5   r6   r   r   r5  r   rL  r   r7  rH  rK   rQ   )rS   rV   rA  rj   r  tnbntck_nrM  r?  tck_n2bn2s   &           rW   r  TestInterop.test_insert  sX   FFDGGTWWrCCHHM!##a&133qs8#$2M6"ssACCo#>Ebb(u	6"g&&&&%'''' 5#$TT^^BrFTM*TT2tt,-Rn 	

5#45??1aHBe	-#w''''&%((((rn   )rV   rA  r	  ra   r>  rj   r   N)r?  r@  rA  rB  rB  rI  rN  rS  r\  rb  ri  ro  rz  r}  r  rC  r  r  s   @rW   r<  r<    sE     -H6-0' D%:C"H(0"0") )rn   r<  c                     a  ] tR tRt o ]P
                  ! RR]P                  ,          4      t]P                  ! ]4      t	R t
R tR tR t]P                  P!                  R. R*O4      R	 4       t]P                  P!                  R. R*O4      R
 4       tR tR t]P                  P!                  R. R+O4      R 4       tR tR tR t]P                  P!                  R. R,O4      R 4       tR tR tR tR tR t]P                  P?                  RR7      R 4       t R t!R t"R t#R t$R t%R t&R  t'R! t(]P                  P!                  R. R-O4      R" 4       t)R# t*R$ t+R% t,R& t-R' t.R(t/V t0R)# ).
TestInterpi  rC   rD   c                n    VP                  V P                  4      VP                  V P                  4      3# r  )rQ   rj   r   r   s   &&rW   _get_xyTestInterp._get_xy  s'    zz$''"BJJtww$777rn   c                    \        \        4      ;_uu_ 4        \        V P                  V P                  R R7       RRR4       R#   + '       g   i     R# ; i)r:   rz  N)rG   rH   r   rj   r   rS   s   &rW   test_non_int_orderTestInterp.test_non_int_order  s0    9%%tww37 &%%%s   #AA	c                    V P                  V4      w  r#\        W#^ R7      p\        V! V4      VRRR7       \        W#^ RR7      p\        V! V4      VRRR7       R# )r   rz  rz   r\   r6   r  Nr=   r  r   r   rS   rT   rj   r   rV   s   &&   rW   test_order_0TestInterp.test_order_0  P    b!r+"rE:r4"rE:rn   c                    V P                  V4      w  r#\        W#^R7      p\        V! V4      VRRR7       \        W#^RR7      p\        V! V4      VRRR7       R# )r0   rz  rz   r\   r  Nr=   r  r  s   &&   rW   test_linearTestInterp.test_linear  r  rn   r6   c                    . ROp. ROp\        \        RR7      ;_uu_ 4        \        W#VR7       RRR4       R#   + '       g   i     R# ; i)r   zShapes of xrE  rz  Nr   r0   r?   rA   rB   r   )r   r0   r?   rA   rB   r   r   r   rG   rI   r   rS   r6   r~   r   s   &&  rW   test_incompatible_x_y TestInterp.test_incompatible_x_y  s2    $:];;qq) <;;;s	   :A	c                   . ROp. ROp\        \        RR7      ;_uu_ 4        \        W#VR7       RRR4       . ROp\        \        RR7      ;_uu_ 4        \        W#VR7       RRR4       . ROp\        P                  ! V4      P                  R	4      p\        \        RR7      ;_uu_ 4        \        W#VR7       RRR4       R#   + '       g   i     L; i  + '       g   i     L}; i  + '       g   i     R# ; i)
r   zx to not have duplicatesrE  rz  NzExpect x to be a 1D strictly)r   r0   r0   r?   rA   rB   r  )r   r?   r0   rA   rB   r   r0   r=   )rG   rI   r   rK   rQ   r   r  s   &&  rW   test_broken_xTestInterp.test_broken_x  s    :-GHHqq) I :-KLLqq) M JJqM!!'*:-KLLqq) ML IH ML
 MLLs#   CC-C+C	C(	+C<	c                    V P                  V4      w  r#R F$  p\        W#V4      p\        V! V4      VRRR7       K&  	  R# )r?   rz   r\   Nr?   rA   rB   r   r   r   r  )rS   rT   rj   r   r6   rV   s   &&    rW   test_not_a_knotTestInterp.test_not_a_knot  s:    b!#A"21-AAbE2E> $rn   c           	        V P                  V4      w  r#\        W#^RR7      p\        V! V4      VRRR7       \        ^^4       F/  p\        V! V^ ,          VR7      V! VR
,          VR7      RR7       K1  	  \        W#^RR
R7      p\        V! V4      VRRR7       \        ^^4       F/  p\        V! V^ ,          VR7      V! VR
,          VR7      RR7       K1  	  R	# )r   r   r]  rz   r\   r   dy=r{   r6   r^  r  Nr=   )r  r   r   r   )rS   rT   rj   r   rV   r*  s   &&    rW   test_periodicTestInterp.test_periodic!  s    b! rJ?"rE: q!AAbeNAbfO%H  rJRH"rE:q!AAbeNAbfO%H rn   c                n   ^p\         P                  P                  R4      p\         P                  ! VP	                  V4      ^
,          4      pVP	                  V4      ^d,          pVR,          V^ &   VP                  V4      VP                  V4      re\        WVVRR7      p\        V! V4      VRR7       R# )r   r   r   r]  rz   r{   Nr=   )rK   rR   r   r   r_  rQ   r   r   )rS   r6   rT   rU   r   r~   r   rV   s   &&&     rW   test_periodic_randomTestInterp.test_periodic_random1  s     ii##D)GGC%%a(2-.a 3&u!zz!}bjjm1qq*=!ae,rn   c                   V P                   P                  ^ ,          p\        P                  P	                  R4      pVP                  V4      ^,          \        P                  ,          p\        P                  ! V4      pRV^ &   ^\        P                  ,          VR	&   \        P                  ! ^V34      p\        P                  ! V4      V^ &   \        P                  ! V4      V^&   VP                  V4      VP                  V4      rT\        WE^R^R7      p\        V4       F&  p\        V! WG,          4      VRV3,          RR7       K(  	  \        V! V^ ,          4      V! VR	,          4      RR7       R# )
r   r   rC   r   r  rU  rz   r{   Nr=   )rj   r   rK   rR   r   r_  r  r   rt  r  r  rQ   r   r   r   )rS   rT   rU   r   r~   r   rV   r*  s   &&      rW   test_periodic_axisTestInterp.test_periodic_axis>  s   GGMM!ii##D)a 1$ruu,GGAJ!BEE	"HHaVvvay!vvay!zz!}bjjm1qq*1EqAAadGQq!tW59 !A$1R56rn   c           	     b   \         P                  P                  R 4      p^p^p\         P                  ! VP	                  V4      4      pVP	                  V4      pVR,          ^,
          V^ &   \        \        4      ;_uu_ 4        \        WEVRR7       RRR4       R#   + '       g   i     R# ; i)r   r   r]  Nr=   )rK   rR   r   r   r_  rG   rI   r   )rS   r   r6   rU   r~   r   s   &     rW   test_periodic_points_exception)TestInterp.test_periodic_points_exceptionO  s    ii##D)GGC%%a()a uqy!:&&qq*= '&&&s   BB.	c           	        \         P                  P                  R 4      p^p^p\         P                  ! VP	                  V4      4      pVP	                  V4      p\         P
                  ! V^V,          ,           4      p\        \        4      ;_uu_ 4        \        WEW&R4       RRR4       R#   + '       g   i     R# ; i)r   r   N)	rK   rR   r   r   r_  rt  rG   rI   r   )rS   r   r6   rU   r~   r   r4   s   &      rW   test_periodic_knots_exception(TestInterp.test_periodic_knots_exceptionZ  s    ii##D)GGC%%a()a HHQQY:&&qQ:6 '&&&s   B--B>	c           	        \        V P                  V P                  VR R7      p\        V P                  V P                  RVR7      p\	        V P                  V4      p\        WB! V P                  4      RR7       \        ^V4       F9  p\	        V P                  W5R7      p\        WB! V P                  VR7      RR7       K;  	  R	# )
r   r]  T)r  r6   rz   r{   r   r   r   N)r   rj   r   r   r   r   r   )rS   r6   rV   ra   rV  r*  s   &&    rW   test_periodic_splevTestInterp.test_periodic_spleve  s     tww1jITWWdgg415DGGS!QtwwZe4 q!A,CC477q!1> rn   c                8   \        V P                  V P                  ^RR7      p\        V P                  V P                  RR7      p\	        V! V P                  4      V! V P                  4      RR7       \
        P                  P                  R4      p^p\
        P                  ! VP                  V4      ^
,          4      pVP                  V4      ^d,          pVR,          V^ &   \        WV^RR7      p\        WVRR7      p\	        V! V4      V! V4      RR7       R# )	rA   r   r]  r  rz   r{   r   Nr=   )
r   rj   r   r   r   rK   rR   r   r   r_  )rS   rV   cubr   rU   r~   r   s   &      rW   test_periodic_cubicTestInterp.test_periodic_cubicr  s    tww1jI$''477J?$''
CLu= ii##D)GGC%%a(2-.a 3&u!qq*=!
3!c!f51rn   c                Z  aaa ^o\        V P                  V P                  SRR7      p\        V P                  S4      o\	        V P                  V P                  SS4      o\
        P                  ! VVV3R l4      p\        V! V P                  4      V! V P                  4      RR7       R# )rA   r   r]  c                 ,   < \        V SSS\        R 7      # )ry   )r   rK   )r~   r5   r6   r4   s   &rW   r  6TestInterp.test_periodic_full_matrix.<locals>.<lambda>  s    K1ar$Brn   rz   r{   N)r   rj   r   r    r!   rK   	vectorizer   )rS   rV   rP  r5   r6   r4   s   &  @@@rW   test_periodic_full_matrix$TestInterp.test_periodic_full_matrix  su     tww1jIDGGQ'&twwA>\\BC$''
BtwwKe<rn   c                   V P                  V4      w  r#R.p\        W#^RV3R7      p\        V! V4      VRRR7       \        V! VR	,          ^4      VP                  V^ ,          ^,          VP                  R7      RRRR7       \        W#^VR3R7      p\        V! V4      VRRR7       \        V! V^ ,          ^4      VP                  V^ ,          ^,          VP                  R7      RRRR7       R# )
r0   Nr]  rz   r\   r;   F)r]   r^   rl  r0   g       @r=   r  r   r   rQ   rP   )rS   rT   rj   r   r   rV   s   &&    rW   test_quadratic_derivTestInterp.test_quadratic_deriv  s    b!i rT3K@"rE:bfaLJJs1vay

J3UU	
 rS$K@"rE:beQKJJs1vay

J3UU	
rn   c                   V P                  V4      w  r#^pR.R.re\        W#WEV3R7      p\        V! V4      VRRR7       \        V! V^ ,          ^4      VP                  V^ ,          ^,          VP                  R7      RRR7       \        V! VR,          ^4      VP                  V^ ,          ^,          VP                  R7      RRR7       R	.R	.re\        W#WEV3R7      p\        V! V4      VRRR7       R# )
rA   r  rz   r\   r;   Nr0   rE   )r0   rF   r=   r?   r   r  )rS   rT   rj   r   r6   der_lder_rrV   s   &&      rW   test_cubic_derivTestInterp.test_cubic_deriv  s    b!  y7)urq%.A"rE:beQKJJuQx{"**J5E	
 	bfaLJJuQx{"**J5E	
 x&urq%.A"rE:rn   c                v   ^^r2VP                  W1P                  R7      pVP                  V4      pRR.pRR	.p\        WEW&V3R7      p\	        V! V4      VRRR7       \	        VP                  V! V^ ,          ^4      V! V^ ,          ^4      .4      TP                  V U	U
u. uF  w  rV
NK	  	  up
p	VP                  R7      4       \	        VP                  V! VR
,          ^4      V! VR
,          ^4      .4      TP                  V U	U
u. uF  w  rV
NK	  	  up
p	VP                  R7      4       R# u up
p	i u up
p	i )r   r;   r]  rz   r\   N)r0   g      ()r?   r0   r  )r?   rE   r=   )rO   rP   r  r   r   r   rQ   )rS   rT   r6   rU   r~   r   r  r  rV   r   vals   &&         rW   test_quintic_derivsTestInterp.test_quintic_derivs  s   !1IIazzI*FF1IF#'"qq%.A!ae%8!AaD!*a!aj!9:

#?IRC#?rzz
R	T!AbE1+q2{!;<

#?IRC#?rzz
R	T $@#?s    D/D5unstabler   c                    ^p\        V P                  V4      pRR.p\        V P                  V P                  WVR3R7      p\	        V! V P                  4      V P                  RRR7       R# )rA   Nr  rz   r\   r  )r?   rF   )r   rj   r   r   r   )rS   r6   r4   r  rV   s   &    rW   test_cubic_deriv_unstable$TestInterp.test_cubic_deriv_unstable  sY     DGGQ'"twwt}M$''
DGG%eDrn   c           	        ^pV P                  V4      w  r4\        VVP                  V^,           4      V^ ,          ,          VR,          VRR	 ,           R,          VP                  V^,           4      VR	,          ,          4      p\        W4W%R
.R
.3R7      p\	        V! V4      VRRR7       \
        P                  ! V! V^ ,          ^4      RRR7      '       g   Q h\
        P                  ! V! VR	,          ^4      RRR7      '       g   Q hR# )r?   r  NrD   r  rz   r\   rC   r  r=   r  )r  r   r  r   r   r!  r"  )rS   rT   r6   rj   r   r4   rV   s   &&     rW   test_knots_not_data_sites$TestInterp.test_knots_not_data_sites  s     b!b!r!u$B"Sb'!R'!r"v%

 rq)/6(';= 	"rE:||AbeQKe<<<<||AbfaL#u====rn   c                    ^pVP                  RR.4      pVP                  RR.4      p\        W4VR.R	.3R7      pVP                  RR^VP                  R7      pV^,          p\	        V! V4      VRRR7       R# )
rA   rC   r2   r  r;   rz   r\   Nr0   rC   r  )rQ   r   rh   rP   r   )rS   rT   r6   r~   r   rV   rj   r   s   &&      rW   test_minimum_points_and_deriv(TestInterp.test_minimum_points_and_deriv  sy     JJBx JJBx qQ'WI0FG[[R2::[6U"rE:rn   c                   . RO;r\        \        4      ;_uu_ 4        \        WR.R3R7       RRR4       \        \        4      ;_uu_ 4        \        WRR7       RRR4       \        \        4      ;_uu_ 4        \        WR.R7       RRR4       \        \        4      ;_uu_ 4        \        W^*R7       RRR4       RRrC\        \        4      ;_uu_ 4        \        WW43R7       RRR4       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L|; i  + '       g   i     R# ; i)r2   Nr  )r2   r?   rA   rB   r   r   r  r  )rS   r~   r   lrs   &    rW   test_deriv_specTestInterp.test_deriv_spec  s     %$:&&qwi->? ' :&&qW5 ' :&&qgY7 ' :&&qR0 '
 1:&&qaV4 '& '& '& '& '& '&&s;   C1D:D(D*D=1D	D	D'	*D:	=E	c                \   VP                  ^4      pV^,          pR.R.rT\        \        RR7      ;_uu_ 4        \        W#WE3R7       RRR4       R.R.rT\        \        RR7      ;_uu_ 4        \        W#WE3R7       RRR4       R#   + '       g   i     LG; i  + '       g   i     R# ; i)	r   zBad boundary conditions at 0.rE  r  NzBad boundary conditions at 6.)r   r   r0   r   )ir   )rO   rG   rI   r   )rS   rT   r~   r   r  r  s   &&    rW   test_deriv_order_too_large%TestInterp.test_deriv_order_too_large
  s    IIaLqDx&1:-LMMqaV4 N x'1:-LMMqaV4 NM NM
 NMMs   B.BB	B+	c                   ^pV P                  V4      w  r4VRV,          ,           pR.R	.re\        W4W%V3R7      p\        V! V4      VRRR7       \        P                  ! V! V^ ,          ^4      V^ ,          ^,          RR7      '       g   Q h\        P                  ! V! VR
,          ^4      V^ ,          ^,          RR7      '       g   Q hR F%  p\        W4VR7      p\        V! V4      VRRR7       K'  	  R# )rA   r1   r  rz   r\   r  rz  N)r0   y              @)r0   y      @       @r=   r   r0   )r  r   r   cmathr"  )rS   rT   r6   rj   r   r  r  rV   s   &&      rW   r  TestInterp.test_complex  s    b!#b&[ !zK=urq%.A"rE:}}Qr!ua[%(1+uEEEE}}Qr"vq\58A;FFFF A"2Q/AAbE2E> rn   c                    VP                  ^
VP                  R7      pVP                  ^
VP                  R7      pR F  p\        W#VR7      pV! V4       K  	  R# )
   r;   rz  Nr   )rO   int32r   )rS   rT   r~   r   r6   rV   s   &&    rW   test_int_xyTestInterp.test_int_xy(  sM    IIbI)IIbI) A"11-AaD rn   c                |    VP                  R^^d4      pVR,          pVR,          pR F  p\        W4VR7       K  	  R# )r0   :NNr   rz  Nr=   r   )rh   r   )rS   rT   rj   r~   r   r6   s   &&    rW   test_sliced_inputTestInterp.test_sliced_input2  s:    [[Q$sGsGAqq) rn   c                   VP                  ^
VP                  R7      pV^,          pVP                  VP                  VP                  ) 3 F>  p\        P
                  ! VR4      P                  V4      p\        \        \        W#4       K@  	  R# )r  r;   Nr=   )
rO   rP   rM   rN   xpxatsetrG   rI   r   )rS   rT   r~   r   zs   &&   rW   test_check_finiteTestInterp.test_check_finite<  sg    IIb

I+qD&&"&&266'*Aq"!!!$A*&8!? +rn   c                    \        \        ^
4      4      pV Uu. uF  q3^,          NK  	  pp\        W$VR7       R# u upi )r  rz  N)listr   r   )rS   r6   r~   ar   s   &&   rW   test_list_inputTestInterp.test_list_inputE  s8     rO1aTT111% s   ;c                   V P                  V4      w  r#VP                  W#3^R7      p^RR.3.p^RR.3.p\        W#^WE3R7      p\        V! V4      VRRR7       \        V! V^ ,          ^4      VP	                  V^ ,          ^,          VP
                  R	7      RRR7       \        V! VR,          ^4      VP	                  V^ ,          ^,          VP
                  R	7      RRR7       R
# )r0   r  r2   rD   rE   rF   r]  rz   r\   r;   Nr=   )r  r   r   r   rQ   rP   )rS   rT   rj   r   r  r  rV   s   &&     rW   test_multiple_rhsTestInterp.test_multiple_rhsL  s    b!XXrhQX'b"Xb"XrUNC"rE:beQKJJuQx{"**J5E	
 	bfaLJJuQx{"**J5E	
rn   c                   \         P                  P                  R 4      p^^r2\         P                  ! VP                  VR7      4      pVP                  V^^^3R7      p\	        WEV4      pVP
                  P                  V^^^38X  g   Q h^VP                  R4      3.p^VP                  R4      3.p\	        WEW'V3R7      pVP
                  P                  W2,           ^,
          ^^^38X  g   Q hR# )r   r   r  Nr   r   r   )rK   rR   r   r   r   r5   r   )	rS   r   r6   rU   r~   r   rV   d_ld_rs	   &        rW   test_shapesTestInterp.test_shapes]  s    ii##D)"1GGCJJAJ&'JJQ1aLJ)qQ'ssyyQ1aL((( 3::i()*3::i()*qQc
;ssyyQUQY1a0000rn   c           	        V P                  V4      w  r#VP                  V4      p\        W#^RR7      p\        W#^R.R.3R7      p\        VP                  VP                  RR7       \        W#^RR7      p\        W#^R.R.3R7      p\        VP                  VP                  RR7       \        W#^RR7      p\        W#^RR.3R7      p\        VP                  VP                  RR7       \        W#^RR7      p\        W#^RR7      p\        VP                  VP                  RR7       \        \        4      ;_uu_ 4        \        W#^R	R7       RRR4       VP                  VP                  V4      VP                  V4      3^R
7      p^RR.3.p^RR.3.p\        W#^Wg3R7      p\        W#^RR7      p\        VP                  VP                  RR7       \        P                  P                  R4      p^^r\        P                  ! VP                  V
R7      4      pVP                  V
^^^3R7      pVP                  V4      VP                  V4      r^VP                  R4      3.p^VP                  R4      3.p\        WWV3R7      p\        WV	RR7      p\        VP                  VP                  RR7       R#   + '       g   i     ELy; i)rA   rk  r]  r[   r{   rj  NrC   rh  typor  r   r   r  r  )rk  rj  r  )Nrj  r  ri  r  )r  r  r   r   r5   rG   rI   r   r  rK   rR   r   r   rQ   rt  )rS   rT   rj   r   rP  rA  r  r  r   r6   rU   r~   r   r  r  s   &&             rW   test_string_aliasesTestInterp.test_string_aliasesl  st   b!VVBZ  !Y?!vh5IJbdd/  !(>@!*0F8(<>bdd/  !5FG!dXJ5GHbdd/  !\B!T:bdd/ :&&rF; ' XXrvvbz266":.QX7b"Xb"X!e^D!(>@bdd/ ii##D)"1GGCJJAJ&'JJQ1aLJ)zz!}bjjm1 288I&'(288I&'(as<a;bdd/1 '&&s   ?J>>K	c                   \         P                  P                  R 4      p^^rC\         P                  ! VP                  VR7      4      pVP                  VR7      p\	        WS4      p\        WVWs4      pVP                  V4      p\        VP                  WVV34      w  rp\        WW;4      p\        VP                  VRRR7       R# )r   r   rz   r\   N)rK   rR   r   r   r   make_interp_full_matrrQ   r}   r   r   r5   )rS   rT   r   r6   rU   r   y_npr   r  r~   r   r4   rV   s   &&           rW   test_full_matrixTestInterp.test_full_matrix  s    ii##D)!1wwszzqz)*zzqz!4#"4t7ZZ^bjj4t"45aqQ*Re%8rn   c                D   \         P                  P                  R4      p^p\        ^^ ^4       EF  p\	        V^,
          ^,          4      p\         P
                  ! VP                  ^V34      4      p\        ^V^,           4       F  pVRV) 1VR13;;,          \         P
                  ! VP                  ^W&,
          34      4      ,          uu&   WVR1RV) 13;;,          \         P
                  ! VP                  ^W&,
          34      4      ,          uu&   K  	  VP                  WD34      pWuRV1V) R13&   VP                  WD34      pWV) R1RV13&   \         P                  ! W234      p	\        \        WD) ^,
          R4      4       FH  w  rjV
^ 8  d    \         P                  ! WZR7      WRV
13&   K+  \         P                  ! WZR7      WV
R13&   KJ  	  VP                  V4      p\        \        WWV4      \         P                  P                  W[4      RR7       EK  	  R# )z
Random elements in diagonal matrix with blocks in the
left lower and right upper corners checking the
implementation of Woodbury algorithm.
r   N)offsetrz   r{   r=   )rK   rR   r   r   intdiagflatrt  r  diagonalr   r   linalgsolve)rS   r   rU   r6   r  r  r*  urlldr  rV   s   &           rW   test_woodburyTestInterp.test_woodbury  s    ii##D)q"aA!a%1%FCJJ1v./A1fqj)#A2#qr'
bkk#**aZ*@AA
"crc'
bkk#**aZ*@AA
 * V,-B#%gvgwx V,-B#%vgh ! A!%!R"@Aq5!{{17A!eH!{{17AeH	 B
 

1A/ra@IIOOA1? ?# !rn   r>  Nr   r  r  )r0   r?   rA   r   )1r?  r@  rA  rB  rK   rh   r  rj   r  r   r  r  r  r  rb   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  rC  r  r  s   @rW   r  r    s    
 
RBEE	"B	B88;; [[S,/* 0* [[S,/* 0*?I  [[S"45
- 6
-7"	>	7 [[S,/
? 0
?2 =
,;,T [[j)E *E>&
;5.5?"*@ [[S,/& 0&
"130j9? ?rn   r  c                   V P                   VP                   8X  g   Q hVP                   V P                   V,           ^,           8X  g   Q hV P                   p\        P                  ! WD3\        P                  R7      p\	        V4       Fd  pW,          pWrV,          8X  d   TpM\        P
                  ! W'4      ^,
          p\        P                  ! W#Wx4      p	WWhV,
          V^,           13&   Kf  	  \        P                  ! WQ4      p
V
# )zAssemble an spline order k with knots t to interpolate
y(x) using full matrices.
Not-a-knot BC only.

This routine is here for testing only (even though it's functional).
r;   )
r   rK   rt  rP   r   r  r,   evaluate_all_bsplslr  )r~   r   r4   r6   rU   Ar  r  leftbbr5   s   &&&&       rW   r  r    s     66QVV66QVVaZ!^###	A
!rzz*A1XtQ4<D??1+a/D ''d9 !!VDF]
  	AHrn   c                z   \        \        P                  WV34      w  rpV P                  pVP                  V,
          ^,
          p\        P                  ! WE3\        P
                  R7      p\        V4       Fd  pW,          pWV,          8X  d   Tp	M\        P                  ! W(4      ^,
          p	\        P                  ! W#W4      p
WWyV,
          V	^,           13&   Kf  	  \        P                  ! VP                  V4      p\        P                  ! VP                  V4      p\        P                  ! W4      pWV33# )z,Make the least-square spline, full matrices.r;   )r}   rK   rQ   r   rt  rP   r   r  r,   r   dotTr!  r  )r~   r   r4   r6   r  rU   r"  r  r  r#  r$  rD  Yr5   s   &&&&          rW   make_lsq_full_matrixr)    s    "**qQi(GA!	A	
QA
!rzz*A1XtQ4<D??1+a/D ''d9 !!VDF]
  	qssAA
qssAA
A!f9rn   methodnorm-eqqrc            	       ,  a  ] tR tRt o ]P
                  P                  R4      t^^utt	]P                  ! ]P                  ]4      4      t]P                  ]4      t]! ]P                  ! ]^ ,          ]R,          ^4      ]	4      t]R 4       t]R 4       tR t]R 4       t]R 4       tR t]R	 4       tR
 t]R 4       t]R 4       t]R 4       t]R 4       t]R 4       t]P>                  PA                  R]!! ]"! ^^4      4      4      R 4       t#R t$Rt%V t&R# )TestLSQi  r   c                   V P                   V P                  V P                  V P                  3w  r#rE\	        W#WE4      w  rg\        W#WEVR 7      p\        VP                  V4       VP                  P                  VP                  V,
          ^,
          38X  g   Q hVw  r\        P                  P                  WRR7      w  p  p\        VP                  V4       R# )r*  )rcondNr=   )r~   r   r4   r6   r)  r   r   r5   r   r   rK   r  lstsq)rS   r*  r~   r   r4   r6   c0AYrV   aar   r  r   s   &&           rW   
test_lstsqTestLSQ.test_lstsq  s     VVTVVTVVTVV3
a%aA1A!v6R ssyyQVVaZ!^---- iioob2o6Aq!R rn   c           	        . \        VP                  V P                  V P                  V P                  34      OV P
                  N5w  r4rVVP                  V4      p\        W4WVVR 7      p\        W4WVWqR7      p	\        VP                  V	P                  RR7       \        VP                  V	P                  RR7       VP
                  V	P
                  8X  g   Q hR# )r0  wr*  rz   r{   N)
r}   rQ   r~   r   r4   r6   ru   r   r   r5   )
rS   r*  rT   r~   r   r4   r6   r:  rV   b_ws
   &&&       rW   test_weightsTestLSQ.test_weights!  s     Hc"**tvvtvvtvv&>?GG
aLLOA!v6aAA=SUU/SUU/sscee||rn   c           	     b   . \        VP                  V P                  V P                  V P                  34      OV P
                  N5w  r#rE\        P                  P                  R 4      P                  VP                  ^ ,          R7      pVP                  V4      p\        W#WEVRR7      p\        W#WEVRR7      p\        W#WERR7      p	\        VP                  VP                  RR7       VP                  VP                  V	P                  VP                  ,
          4      R8  4      '       d   Q hR# )	r   r   r+  r9  r,  r0  rz   r{   N)r}   rQ   r~   r   r4   r6   rK   rR   r  r  r   r   r   r5   r   abs)
rS   rT   r~   r   r4   r6   r:  b_neb_qrb_no_ws
   &&        rW   test_weights_sameTestLSQ.test_weights_same.  s    Gc"**tvvtvvtvv&>?GG
aII!!$'//QWWQZ/@JJqMqQQyAqQQt< qD9U366"&&DFF!23e;<<<<<rn   c                   . \        VP                  V P                  V P                  34      OV P                  NV P
                  N5w  r4rV\        P                  P                  R 4      pVP                  V^^^3R7      pVP                  V4      p\        W8WEVR7      p	V	P                  P                  VP                  ^ ,          V,
          ^,
          ^^^38X  g   Q hR# )r   r   r0  N)r}   rQ   r~   r4   r6   rU   rK   rR   r   r   r5   r   )
rS   r*  rT   r~   r4   r6   rU   r   r   rV   s
   &&&       rW   r  TestLSQ.test_multiple_rhs;  s    Gc"**tvvtvv&67GGG
aii##D)JJQ1aLJ)JJqMA!v6ssyyQWWQZ!^a/Aq9999rn   c                h   . \        VP                  V P                  V P                  34      OV P                  NV P
                  N5w  r4rV^p\        P                  P                  R4      pVP                  Wg3R7      p	VP                  V	4      p	\        W9WEVR7      p
\        V4       Uu. uF  p\        W9RV3,          WEVR7      NK  	  ppTP                  \        V4       Uu. uF  qV,          P                  NK  	  up4      P                  p\        WP                  RR7       R# u upi u upi )rA   r   r   r0  rU  r[   r{   N)r}   rQ   r~   r4   r6   rU   rK   rR   r   r   r   r   r5   r'  r   )rS   r*  rT   r~   r4   r6   rU   nrhsr   r   rV   r*  r$  coefss   &&&           rW   test_multiple_rhs_2TestLSQ.test_multiple_rhs_2E  s    Gc"**tvvtvv&67GGG
aii##D)JJQIJ&JJqMA!v6 T{$"! a1a4!v>" 	 $5;7;aQ%'';78::ss/	$7s   + D*%D/c                ~   . \        VP                  V P                  V P                  34      OV P                  NV P
                  N5w  r#rE^p\        P                  P                  WV3R7      pVP                  V4      p\        W'W4RR7      p\        W'W4RR7      p	\        VP                  V	P                  RR7       R# )rA   r   r,  r0  r+  r[   r{   N)r}   rQ   r~   r4   r6   rU   rK   rR   r   r   r5   )
rS   rT   r~   r4   r6   rU   rH  r   rA  b_neqs
   &&        rW   test_multiple_rhs_3TestLSQ.test_multiple_rhs_3T  s    Gc"**tvvtvv&67GGG
aII1),JJqMqQ$7a9=e4rn   c                   . \        VP                  V P                  V P                  34      OV P                  N5w  r4pVP                  V P
                  R,          4      p\        W6WEVR7      p\        W2P                  V4      WEVR7      p\        W2P                  V4      WEVR7      p	\        V! V4      V! V4      RV	! V4      ,          ,           RRR7       R# )r2   r0  r1   r[   r\   N      ?       @)
r}   rQ   r~   r4   r6   r   r   r  r  r   )
rS   r*  rT   r~   r4   r6   r|  rV   r
  r  s
   &&&       rW   r  TestLSQ.test_complex]  s     =3rzzDFFDFF#34<dff<aZZ(+,A17q''"+qFCq''"+qFC!d1gDG3%eLrn   c                   . \        VP                  V P                  V P                  34      OV P                  N5w  r#pVP                  V P
                  R,          4      pVP                  WU3^R7      p\        W%W44      p\        W!P                  V4      W44      p\        W!P                  V4      W44      p\        V! V4      V! V4      RV! V4      ,          ,           RRR7       VP                  WU3^R7      p\        W%W44      p\        W!P                  V4      W44      p\        W!P                  V4      W44      p\        V! V4      V! V4      RV! V4      ,          ,           RRR7       R# )r2   r  r1   r[   r\   NrQ  )r}   rQ   r~   r4   r6   r   r   r   r  r  r   )	rS   rT   r~   r4   r6   r|  rV   r
  r  s	   &&       rW   test_complex_2TestLSQ.test_complex_2i  s"    =3rzzDFFDFF#34<dff<aZZ(+,XXrhQX'A1(q''"+q4q''"+q4!d1gDG3%eL XXrhQX'A1(q''"+q4q''"+q4!d1gDG3%eLrn   c                    \         P                  ! ^
4      P                  \        4      p\         P                  ! ^
4      P                  \        4      p\	        V^R7      p\        W#V^VR7       R# )r  rz  r6   r*  N)rK   rO   astyper  r   r   rS   r*  r~   r   r4   s   &&   rW   r  TestLSQ.test_int_xy  sK    IIbM  %IIbM  %AOa1V4rn   c                   \         P                  ! ^
\         P                  R7      p\         P                  ! ^
\         P                  R7      p\        V^R7      p\	        W#V^VR7      p\	        VP                  \        4      VP                  \        4      VP                  \        4      ^VR7      pVR,          VRR	 ,           R,          p\        V! V4      V! V4      RR7       R# )
r  r;   rz  rW  r  NrD   r[   r{   r=   )rK   rO   float32r   r   rX  floatr   )rS   r*  r~   r   r4   spl_f32spl_f64x2s   &&      rW   test_f32_xyTestLSQ.test_f32_xy  s    IIb

+IIb

+AO!!Qv>!HHUOQXXe_ahhuo6
 eafn#WR[u=rn   c                    \         P                  ! R^^d4      pVR,          pVR,          p\        V^4      p\        W4V^VR7       R# )r0   :NNrA   rW  Nr=   )rK   rh   r   r   )rS   r*  rj   r~   r   r4   s   &&    rW   r  TestLSQ.test_sliced_input  sA     [[Q$sGsGAqMa1V4rn   c           
     &   \         P                  ! ^4      P                  \        4      pV^,          p\	        V^4      p\         P
                  \         P                  \         P                  ) 3 F  pWSR&   \        \        \        W#WAR7       K   	  R# )   r0  Nr=   )
rK   rO   rX  r]  r   rM   rN   rG   rI   r   )rS   r*  r~   r   r4   r  s   &&    rW   test_checkfiniteTestLSQ.test_checkfinite  sd     IIbM  'qDAqM&&"&&266'*AbE*oqQN +rn   c                    V P                   V P                  V P                  rCpVP                  R R7       VP                  R R7       VP                  R R7       \	        W#WAR7       R# )Fr  )r~   r   r4   r*  N)r~   r   r4   r  r   rY  s   &&   rW   r  TestLSQ.test_read_only  sO     &&$&&$&&a	


	


	


!A5rn   r6   c                4   V P                   V P                  r2\        \        P                  ! V^ ,          VR	,          ^4      V4      p\        W#WARR7      p\        W#WARR7      pVR,          VRR	 ,           R,          p\        V! V4      V! V4      RR7       R# )
r   r+  rW  r,  r  NrD   r[   r{   r=   )r~   r   r   rK   rh   r   r   )rS   r6   r~   r   r4   spl_norm_eqspl_qrrj   s   &&      rW   test_qr_vs_norm_eqTestLSQ.test_qr_vs_norm_eq  s|     vvtvv1BKK!aeQ/3%aA9E qd;eafn#B%@rn   c                   \         P                  ! V P                  ^4      p\         P                  ! V P                  ^4      p\	        V P                  V P                  V P
                  ^RR7      p\	        WV P
                  ^RR7      pVR,          VRR ,           R,          p\        V! V4      V! V4      RR7       R# )	r?   r,  rW  r  NrD   r[   r{   r=   )rK   repeatr~   r   r   r4   r   )rS   r~   r   r  spl_2rj   s   &     rW   test_duplicatesTestLSQ.test_duplicates  s    IIdffa IIdffa !DIdff$?eafn#b	5959rn   r>  Nr=   )'r?  r@  rA  rB  rK   rR   r   r   rU   r6   r   r~   r   r   rh   r4   parametrize_lsq_methodsr6  r<  rC  r  rJ  rN  r  rT  r  ra  r  rg  r  rb   r  r  r  r   rn  rs  rC  r  r  s   @rW   r.  r.    s    
 ))


%CqDAq


1A

1AAaD!B%+Q/A! ! 
 
= : : 0 05 	M 	MM, 5 5 
> 
> 5 5 O O 6 6 [[S$uQ{"34A 5A: :rn   r.  c                   @   a  ] tR tRt o RtR t]R 4       tR tRt	V t
R# )PackedMatrixi  a_  A simplified CSR format for when non-zeros in each row are consecutive.

Assuming that each row of an `(m, nc)` matrix 1) only has `nz` non-zeros, and
2) these non-zeros are consecutive, we only store an `(m, nz)` matrix of
non-zeros and a 1D array of row offsets. This way, a row `i` of the original
matrix A is ``A[i, offset[i]: offset[i] + nz]``.

c                    Wn         W n        W0n        VP                  ^8X  g   Q hVP                  ^8X  g   Q hVP                  ^ ,          VP                  ^ ,          8X  g   Q hR# )r?   N)r  r  ncr7  r   )rS   r  r  ry  s   &&&&rW   __init__PackedMatrix.__init__  sQ    vv{{{{awwqzV\\!_,,,rn   c                T    V P                   P                  ^ ,          V P                  3# rG  )r  r   ry  r  s   &rW   r   PackedMatrix.shape  s    vv||A''rn   c                   \         P                  ! V P                  4      pV P                  P                  ^,          p\	        VP                  ^ ,          4       Fw  p\        V P                  V P                  V,          ,
          V4      pV P                  VRV13,          WV P                  V,          V P                  V,          V,           13&   Ky  	  V# )r0   N)rK   rt  r   r  r   minry  r  )rS   outnelemr*  nels   &    rW   todensePackedMatrix.todense  s    hhtzz"Qsyy|$AdggA.6C:>&&DSD/C4;;q>$++a.3"6667 % 
rn   )r  ry  r  N)r?  r@  rA  rB  __doc__rz  propertyr   r  rC  r  r  s   @rW   rw  rw    s-     - ( ( rn   rw  c                   ^ RI Hp V! R\        P                  RR7      pV P                  pV P
                  pV P                  pVP                  w  rVP                  ^ ,          V8X  g   Q hVP                  4       p
VP                  4       p\        W(4       F  pWl,          p\        W4       F  pV\        W4      8  d    K,  V! W^ 3,          W^ 3,          4      w  pppVW^ 3&   \        ^V	4       F3  p\        VVWV3,          WV3,          4      w  WV3&   WV^,
          3&   K5  	  RWR3&   \        VP                  ^,          4       F,  p\        VVWV3,          WV3,          4      w  WV3&   WV3&   K.  	  K  	  K  	  \        \        V
P                  ^ ,          4      4      p\        V
\        P                  ! V\        P                  R7      V4      pVV3# )zbThis is a python counterpart of the `_qr_reduce` routine,
declared in interpolate/src/__fitpack.h
)get_lapack_funcslartg	preferred)r<   ilp64rC   r;   r=   )scipy.linalg.lapackr  rK   rP   r  r  ry  r   r9  r   r  fprotar  rw  rs  int64)a_pr   startrowr  dlartgr  r  ry  r  nzRr  r*  oir  r5   r  r  r  offsR_ps   &&&                  rW   _qr_reduce_pyr    s    5gRZZ{KF 	AZZF	BGGEA771:??	A	
B8YrACJ Q!tWa1g.GAq! AdG1b\%+Aq!qD'1T7%C"Q$ac6 "AeH 288A;'%+Aq"T(B!tH%E"a4"T( (   * aggaj!"D
q"((4rxx8"
=C7Nrn   c                `    W,          W,          ,           pV) V,          W,          ,           pWE3# )z@Givens rotate [a, b].

[aa] = [ c s] @ [a]
[bb]   [-s c]   [b]

r>  )r5   r  r  rV   r5  r$  s   &&&&  rW   r  r    s)     #)B
AB6Mrn   c                N   V P                   pVP                  w  r4V P                  pVP                  ^ ,          VP                  ^ ,          8X  g   Q h\        P                  ! VRV 4      pW^,
          ,          W%^,
          ^ 3,          ,          We^,
          R3&   \        V^,
          RR4       Fr  p\        WEV,
          4      pW'^V1R3,          Wg^,           Wx,           1R3,          ,          P                  ^ R7      p	W,          V	,
          W'^ 3,          ,          WgR3&   Kt  	  V# )zxBacksubsitution solve upper triangular banded `R @ c = y.`

`R` is in the "packed" format: `R[i, :]` is `a[i, i:i+k+1]`
N.r  r=   )r  r   ry  rK   r   r   r  r  )
r  r   r  r   r  ry  r5   r*  r  summs
   &&        rW   fpbackr     s    
 	AGGEA	B771:###
afAT7Q!tQwZ'AdCiL2a4R "dmQsUD.!Ac!%in$55:::BdTka1g-S&		 !
 Hrn   c                   D   a  ] tR tRt o R tR tR tR tR tR t	Rt
V tR	# )
TestGivensQRi4  c                    ^p\         P                  ! V\        R7      pV^,          ^^V,           ,          ,           p\        W24      pW4WR3# )rA   r;   )rK   rO   r]  r   )rS   rU   r6   r~   r   r4   s   &&    rW   _get_xytTestGivensQR._get_xyt7  s@    IIau%qD1ac7NQzrn   c                   ^
pV P                  V4      w  r#rE\        P                  ! W$V4      p\        P                  ! VP                  4       4      w  rxVP                  V,          p	VP                  w  rWP                  ^ ,          V,
          ^,
          8X  g   Q hVP                  RRV^,           1,          p\        P                  ! V\        P                  R7      pVP                  P                  W^,           4      p\        WV4      pVR,          p\        P                   ! WW4       \#        \        P$                  ! VP                  4       V,           VP                  4       V,
          4      \        P&                  ! V4      RR7       \#        \        P$                  ! \)        WR,          ,
          4      \)        WR,          ,           4      4      \        P&                  ! V	4      RR7       \        P*                  ! W4      p\        P,                  ! VP.                  VP0                  W/WE\        P2                  ! V4      V4      w  p p\#        VVR,          RR7       R# )	r  Nr;   r[   r{   gvIh%L=-a=rU  N)rU  r   )r  r   rb  r!  r,  r  r'  r   indicesrK   ascontiguousarrayr  datar   rw  r,   	qr_reducer   minimumr   r?  r  r  r  ry  ru   )rS   rU   r~   r   r4   r6   a_csrqr  qTyr  ry  r  r"  r  y_c_fullc_bandedr   s   &                  rW   test_vs_fullTestGivensQR.test_vs_full>  s   ]]1%
a %%aA. uuU]]_%ccAg WWQZ!^a''''w!A#w'%%fBHH=JJqA#&B'wZ1b- 	

199;?#$99;?457]]15EE	S

3sX~#6#&sX~#689;s9KRW	Y !!!addA1aRTU!QU;rn   c                   ^
pV P                  V4      w  r#rE\        P                  ! W$V4      pVP                  w  rxWP                  ^ ,          V,
          ^,
          8X  g   Q hVP                  RRV^,           1,          p	\
        P                  ! V	\
        P                  R7      p	VP                  P                  Wu^,           4      p
\        WV4      pVR,          p\        W4      w  r\        P                  ! WW4       \        VP                  VP                  RR7       \!        VP"                  VP"                  RR7       VP$                  VP$                  8X  g   Q h\        WRR7       R# )r  Nr;   r[   r{   F)check_dtyper  )r  r   rb  r   r  rK   r  r  r  r   rw  r  r,   r  r   r  r   r  ry  )rS   rU   r~   r   r4   r6   r  r  ry  r  r"  r  r  RRr   s   &              rW   test_py_vs_compiled TestGivensQR.test_py_vs_compileda  s   ]]1%
a %%aA.WWQZ!^a''''w!A#w'%%fBHH=JJqA#&B'wZq%1b.acc.		188?uu}}U+rn   c                t   ^
pV P                  V4      w  r#rE\        P                  ! ^V^,           \        R7      p\        P
                  ! W$WV4      w  rxp	VP                  ^ ,          p
\        P                  ! W$V4      pWR,          ,          P                  4       pVP                  P                  W^,           34      pVP                  RRV^,           1,          P                  \        P                  4      p\        W}RR7       \!        W4       WP                  ^ ,          V,
          ^,
          8X  g   Q hR# )r  r;   Nr[   r{   r  )r  rK   rO   r]  r,   data_matrixr   r   rb  tocsrr  r   r  rX  r  r   r   )rS   rU   r~   r   r4   r6   r:  r"  r  ry  r  r  a_wA_offset_s   &              rW   test_data_matrixTestGivensQR.test_data_matrix|  s    ]]1%
aIIa1E* ,,Q182GGAJ%%aA.z!((*XXqA#h'++g1g&--bhh7E*(WWQZ!^a''''rn   c                   ^
pV P                  V4      w  r#rE\        P                  W3^,          3,          p\        P                  ! W$V\        P
                  ! V4      4      w  rgp\        WgV4      p	\        P                  ! WgW4       \        W4      p
\        P                  ! WhW#WE\        P
                  ! V4      V4      w  p p\        WRR7       R# )r  rz   r{   N)
r  rK   r?  r,   r  ru   rw  r  r  r   )rS   rU   r~   r   r4   r6   r"  r  ry  r  r5   r	  r   s   &            rW   test_fpbackTestGivensQR.test_fpback  s    ]]1%
aEE!T'N ,,Q1bll1oF2B'1b,1L??1!bll1oqIAqE*rn   c                0   ^
pV P                  V4      w  r#rE\        P                  ! V^,           3\        R7      pV FU  p\	        \
        P                  ! WEWqV^,           4      V4       \	        \
        P                  ! WEWq^V,          4      V4       KW  	  R# )r  r;   N)r  rK   rt  r]  r   r,   r   )rS   rU   r~   r   r4   r6   
zero_arrayr  s   &       rW   test_evaluate_all_bspl#TestGivensQR.test_evaluate_all_bspl  s{    ]]1%
aXXq1uhe4
D**1!a%@*N**1!A#>
L rn   r>  N)r?  r@  rA  rB  r  r  r  r  r  r  rC  r  r  s   @rW   r  r  4  s+     !<F,6("+L Lrn   r  c                     \         P                  P                  \         P                  P                  \         P                  P	                  \
        4      4      R V 4      # )r  )ospathr  abspathdirname__file__)basenames   &rW   	data_filer    s8    77<<(AB* *rn   c                   t   a  ] tR tRt o R tR tR t]P                  P                  ^4      R 4       t
RtV tR# )TestSmoothingSplinei  c                R   \         P                  P                  R 4      p^dp\         P                  ! VP	                  V4      ^,          ^,
          4      pV^,          \         P
                  ! ^V,          4      ,          V^,          ,           VP                  RRV4      ,           p\        \        4      ;_uu_ 4        \        W4R,          4       RRR4       \        \        4      ;_uu_ 4        \        VR,          V4       RRR4       \        \        4      ;_uu_ 4        \        VP                  ^V4      V4       RRR4       \        \        4      ;_uu_ 4        \        VRRR1,          V4       RRR4       \         P                  ! V4      pV^,          V^ &   \        \        4      ;_uu_ 4        \        WT4       RRR4       \         P                  ! ^4      p\         P                  ! ^4      pRp\        P                  ! \        VR7      ;_uu_ 4        \        W44       RRR4       R#   + '       g   i     ELk; i  + '       g   i     ELL; i  + '       g   i     EL$; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)r   rC   r(  r  Nz)``x`` and ``y`` length must be at least 5rE  r=   )rK   rR   r   r   r_  r  normalrG   rI   r   r   r9  rO   r  rb   r   )rS   r   rU   r~   r   x_duplexception_messages   &      rW   test_invalid_input&TestSmoothingSpline.test_invalid_input  s   ii##D)GGC%%a(1,q01qD266!a%= 1a4'#**Ra*@@ :&&!!rU+ ':&&!!B%+ ':&&!!))Aq/15 ' :&&!!DbD'1- ' 1Iq	:&&!&, ' IIaLGGAJG]]:->??!!' @?+ '&&&&&&&& '&& '& @??sH   =H2/I"II.6JJ2I	I	I+	.I?	J	J&	c                   \         P                  ! \        R4      4      ;_uu_ 4       pVR,          pVR,          pVR,          pRRR4       \        XX4      ! V4      p\	        VXRRRR7       R#   + '       g   i     L4; i)	a}  
Data is generated in the following way:
>>> np.random.seed(1234)
>>> n = 100
>>> x = np.sort(np.random.random_sample(n) * 4 - 2)
>>> y = np.sin(x) + np.random.normal(scale=.5, size=n)
>>> np.savetxt('x.csv', x)
>>> np.savetxt('y.csv', y)

We obtain the result of performing the GCV smoothing splines
package (by Woltring, gcvspl) on the sample data points
using its version for Octave (https://github.com/srkuberski/gcvspl).
In order to use this implementation, one should clone the repository
and open the folder in Octave.
In Octave, we load up ``x`` and ``y`` (generated from Python code
above):

>>> x = csvread('x.csv');
>>> y = csvread('y.csv');

Then, in order to access the implementation, we compile gcvspl files in
Octave:

>>> mex gcvsplmex.c gcvspl.c
>>> mex spldermex.c gcvspl.c

The first function computes the vector of unknowns from the dataset
(x, y) while the second one evaluates the spline in certain points
with known vector of coefficients.

>>> c = gcvsplmex( x, y, 2 );
>>> y0 = spldermex( x, c, 2, x, 0 );

If we want to compare the results of the gcvspl code, we can save
``y0`` in csv file:

>>> csvwrite('y0.csv', y0);

z
gcvspl.npzr~   r   y_GCVSPLN-C6?F)r]   r^   r  )rK   loadr  r   r   )rS   r  r~   r   r  y_comprs   &     rW   test_compare_with_GCVSPL,TestSmoothingSpline.test_compare_with_GCVSPL  sj    R WWY|,--S	AS	AJ'H . (1-a0 	4US .-s   A00B 	c                L   \         P                  P                  R4      p^dp\         P                  ! VP	                  V4      ^,          ^,
          4      pV^,          \         P
                  ! ^V,          4      ,          V^,          ,           VP                  RRV4      ,           pVP                  V4      VP                  V4      rT\        WERR7      p\        WE^RR7      pVP                  V^ ,          VR
,          ^V,          4      p\        V! V4      V! V4      RR7       R	# )z~
In case the regularization parameter is 0, the resulting spline
is an interpolation spline with natural boundary conditions.
r   rC   r(  )lamrk  r  r[   r{   Nr=   )rK   rR   r   r   r_  r  r  rQ   r   r   rh   r   )	rS   rT   r   rU   r~   r   
spline_GCVspline_interpgrids	   &&       rW   test_non_regularized_case-TestSmoothingSpline.test_non_regularized_case	  s     ii##D)GGC%%a(1,q01qD266!a%= 1a4'#**Ra*@@zz!}bjjm1*1R8
*1IF{{1Q42A.
4(%d+"	$rn   c                8   \         P                  P                  R 4      p^dp\         P                  ! VP	                  V4      ^,          ^,
          4      pV^,          \         P
                  ! ^V,          4      ,          V^,          ,           VP                  RRV4      ,           p\        VP                  WE34      w  rE\        WE4      pVP                  \        ^d4      ^
R7       F  pVP                  V4      p\        P                  ! V\        V4      4      P!                  R4       \        WEV4      p	\#        V! WG,          4      WW,          ,
          4      p
\#        V	! WG,          4      WW,          ,
          4      pW8  g   K  \%        RV
R RVR 24      h	  R# )	r   rC   r(  r   g      >@zJSpline with weights should be closer to the points than the original one: z.4z < N)rK   rR   r   r   r_  r  r  r}   rQ   r   choicer   r  r  r  r  r  r?  rI   )rS   rT   r   rU   r~   r   rV  indr:  spl_worigweighteds   &&          rW   test_weighted_smoothing_spline2TestSmoothingSpline.test_weighted_smoothing_spline	  sC    ii##D)GGC%%a(1,q01qD266!a%= 1a4'#**Ra*@@2::v&#A) ::eCjr:2C
AFF1c#h##C()!2E s16{QV+,D5=1612H  $CCG)3$,R="2 3 3 3rn   r>  N)r?  r@  rA  rB  r  r  r  rb   r  	fail_slowr  rC  r  r  s   @rW   r  r    s9     
(>6Tp$* [[13 3rn   r  c           	     <  aaaaaa	a
 V w  o	o
Vw  oo\        S4      S,
          ^,
          pVS^,           8  g   Q h\        S4      S,
          ^,
          oSS^,           8  g   Q h\        VVVVVV	V
3R l\        V4       4       4      p\        P                  ! V4      # )z-A naive 2D tensort product spline evaluation.c           	   3      <"   T FG  p\        S4       F5  pSW3,          \        SSVS4      ,          \        S	SVS4      ,          x  K7  	  KI  	  R # 5ir  )r   rD  )
r  ixiyr5   r6   nytxtyr~   r   s
   &  rW   r  bspline2.<locals>.<genexpr>B	  sO      7!"E"Ib i!Aq"b/)AaBO;;,5 <!s   AA)ra  r  r   rK   rQ   )r   r4   r5   r6   nxr8  r  r  r  r~   r   s   &&ff  @@@@@rW   bspline2r  :	  s    DAqFB	R1qB!A#II	R1qB!A#II
 7 7b	7 7C::c?rn   c                 t   V^ 8X  d(   W2,          T u;8:  d   W2^,           ,          8  d   R#  R# W2V,           ,          W2,          8X  d   RpMHWV,          ,
          W2V,           ,          W2,          ,
          ,          \        W^,
          W#4      ,          pW2V,           ^,           ,          W2^,           ,          8X  d   RpWE,           # W2V,           ^,           ,          V ,
          W2V,           ^,           ,          W2^,           ,          ,
          ,          \        W^,
          V^,           V4      ,          pWE,           # )r   r2   rC   rD  r  s   &&&&  rW   rD  rD  G	  s    Avda(!aC&(s1(c11v~A$hQ3!$'!AsA/91Qx1qS6 7N !AhlQs1uXA#./!AsAaC2CC7Nrn   c                    a aaa \        S4      S,
          ^,
          pVS^,           8  d   \        S4      V8  g   Q h\        VVVV 3R l\        V4       4       4      # )r0   c              3   \   <"   T F!  pSV,          \        SSVS4      ,          x  K#  	  R # 5ir  r  r  s   & rW   r  bspline.<locals>.<genexpr>X	  s'     6Xqta1am##Xr  )ra  r  r   )r~   r4   r5   r6   rU   s   ffff rW   rv  rv  U	  sD    A
QA1H3q6Q;''6U1X666rn   c                   0   a  ] tR tRt o RR ltR tRtV tR# )
NdBSpline0i[	  c                r   \        V4      pV\        VP                  4      8:  g   Q h \        V4       \        ;QJ d    . R V 4       F  NK  	  5M! R V 4       4      V n        \        ;QJ d    . R V 4       F  NK  	  5M! R V 4       4      V n        W n        R#   \         d    T3T,          p Li ; i)aW  Tensor product spline object.

c[i1, i2, ..., id] * B(x1, i1) * B(x2, i2) * ... * B(xd, id)

Parameters
----------
c : ndarray, shape (n1, n2, ..., nd, ...)
    b-spline coefficients
t : tuple of 1D ndarrays
    knot vectors in directions 1, 2, ... d
    ``len(t[i]) == n[i] + k + 1``
k : int or length-d tuple of integers
    spline degrees.
c              3   N   "   T F  p\         P                  ! V4      x  K  	  R # 5ir  )operatorindex)r  kis   & rW   r  &NdBSpline0.__init__.<locals>.<genexpr>t	  s     6Abx~~b))As   #%c              3   Z   "   T F!  p\         P                  ! V\        R 7      x  K#  	  R# 5i)r;   N)rK   rQ   r]  )r  tis   & rW   r  r  u	  s     ?Qrrzz"E22Qs   )+N)ra  r   rH   rL  r6   r4   r5   )rS   r4   r5   r6   r7  s   &&&& rW   rz  NdBSpline0.__init__\	  s     1vs177|###	F
 6A66A66?Q??Q??  	T	A	s   B B65B6c                F   \        V P                  4      p\        V4      V8X  g   Q hR .V,          p\        V4       F  pV P                  V,          W,          reV P                  V,          pWeV,          8X  d   WsV&   M\        P
                  ! WV4      ^,
          W4&   WSV,          ,          Tu;8:  d   WSV,          ^,           ,          8:  g   Q h Q hW4,          V8  d    W4,          \        V4      V,
          8  d   K  Q h	  \        V4      p^ p\        V4       Uu. uF:  p\        W4,          V P                  V,          ,
          W4,          ^,           4      NK<  	  p	p\        P                  ! V	!   F  p
V P                  V
,          \        P                  ! \        V4       Uu. uF?  p\        W,          V P                  V,          W,          V P                  V,          4      NKA  	  up4      ,          pW,          pK  	  \        P                  ! V4      # u upi u upi )none)ra  r4   r   r6   rK   r  rL  	itertoolsproductr5   prodrD  rQ   )rS   r~   r7  r*  r  tdxdr6   r%  itersidxterms   &&          rW   __call__NdBSpline0.__call__x	  s   466{1v~~ JtOtAVVAYq	A U{!r.2d8r/R!QZ/////419B!!333  !H
 <A$KHKqqtdffQi'2KH$$e,C66#;38;*@3>a +,AD$&&)SVTVVAY*O3>*@ "A ADNF - zz&!! I*@s   A H%AH)r5   r6   r4   NrA   )r?  r@  rA  rB  rz  r  rC  r  r  s   @rW   r  r  [	  s     8" "rn   r  c                     a  ] tR tRt o R t]3R lt]3R ltR tR t	R t
R tR	 tR
 tR tR t]3R ltR tR tR tR t]P,                  P/                  RRR.4      ]P,                  P/                  RRR.4      R 4       4       t]P,                  P/                  RR R!.4      R 4       tR tR tR tR tR tR tRt V t!R# )"TestNdBSplinei	  c                `   \         P                  P                  R 4      p^^rC^p\         P                  ! VP	                  W4,           ^,           R7      4      pVP	                  W53R7      pVP                  V4      pVP                  V4      p\        WgV4      p\        V3Wt4      p	VP	                  ^R7      p
VP                  V
4      p
\        V	! V
R,          4      V! V
4      RR7       V	! V
R,          4      P                  V
P                  ^ ,          VP                  ^,          38X  g   Q hR# )r  r   Nrz   r{   r  )
rK   rR   r  r   r  rQ   r   r   r   r   )rS   rT   r   rU   r6   n_trr4   r5   rV   nbxis   &&         rW   test_1DTestNdBSpline.test_1D	  s    ii##E*11GGCKKQUQYK/0KKaYK'JJqMJJqMA!tQ"[[b[!ZZ^ 	2g;"E	+"W+$$!aggaj(AAAArn   c                &   VP                  ^4      pV^,          p\        W#^R7      pV^,          ^V,          ,           p\        W%^R7      pVP                  VP                  3pVP                  R,          VP                  R,          ,          pWx^3# )r   rz  r  NrU  rO   r   r4   r5   	rS   rT   r~   r   rV  y_1r  t2r	  s	   &&       rW   make_2d_caseTestNdBSpline.make_2d_case	  sx    IIaLqD +dQqSj"1Q/eeUWWUU7^eggg..qyrn   c                   VP                  ^4      pV^,          p\        W#^R7      pVP                  ^VP                  R7      R,           pV^,          ^V,          ,           p\        W%^R7      pVP                  VP                  3pVP                  R,          VP                  R,          ,          pWxVP
                  VP
                  3# )r   rz  r;   r(  r  r  )rO   r   rP   r4   r5   r6   r  s	   &&       rW   make_2d_mixedTestNdBSpline.make_2d_mixed	  s    IIaLqD +IIarzzI*S0dQqSj"1Q/eeUWWUU7^eggg..suuegg%%rn   c                `   . ROpV P                  VR7      w  r4pV UUu. uF*  w  rgV^,          V^,          ^V,          ,           ,          NK,  	  pppV U	U
u. uFI  p	\        T	V U
u. uF  p
\        P                  ! V
4      NK  	  up
\        P                  ! V4      V4      NKK  	  pp	p
\        P                  ! V\        P                  R7      p\        VP                  V4      VP                  WP                  R7      RRR7       \        W4^R7      pV! V4      P                  \        V4      38X  g   Q h\        V! V4      VP                  WP                  R7      RR7       \        P                  ! V4      p\        P                  VR&   VP                  V4      p\        VP                  V! V4      4      VP                  . RO4      4       \        P                  P                  R4      pVP                  RR	7      ^,          pVP                  V4      pV! V4      pVP                  R8X  g   Q hVP                  VR4      P                   pVR,          VR,          rv\        \#        WR7      V^,          V^,          ^V,          ,           ,          RR7       R
# u uppi u up
i u up
p	i )r(  ry   r;   Frz   rm  r]   rz  r{   r  r   Nr(  r:   )r:   r0   )r   r(  r  )TFF)rB   rA   r?   )rB   rA   )r=   r?   )r   .)r0   .)r!  r  rK   rQ   rP   r   r   r   ra  rM   r   r   rR   r  r  r   r'  r   )rS   rT   r  r   r	  r6   r~   r   targetr   r   rA  bspl2r   r%  rrrs   &&              rW   test_2D_separableTestNdBSpline.test_2D_separable	  s,   /%%%,	467B&1!Q$!Q$1*%%B7 

 B (*+1A+

2	
  	 
 ZZ"**-

2

6
<$)"	$ "A&Ry3r7+---b	

6
<5	J ZZ^664ZZ^r+RZZ8L-MN ii##E*[[i[(1,ZZ^r||v%%% jjW%''6{CK1/11qs
+%	9M 8
 ,
s   0JJ*&J%!J*%J*c                   ^p. ROpV UUu. uF*  w  rEV^,          V^,          ^V,          ,           ,          NK,  	  pppV P                  VR7      w  rxp	VP                  WW3^R7      p
Rp\        Wz^R7      pV! V4      p\        WxV	4      ! V4      pVP                  R8X  g   Q h\	        VVP                  V.^,          4      RR7       V! V4      P                  \
        P                  ! V4      RR VP                  P                  VR ,           8X  g   Q h\	        V! V4      VP                  WaP                  R7      R,          RR	R
7       VP                  V
R4      p\        W^R7      pV! V4      pVP                  R8X  g   Q hVP                  RVP                  R7      V,          p\	        VVRR7       V! V4      P                  \
        P                  ! V4      RR VP                  P                  VR ,           8X  g   Q h\	        V! V4      VP                  WaP                  R7      R,          RR	R
7       R# u uppi )r?   ry   r  rz  rz   r{   Nr;   FgvIh%,=r'  r)  r(  rB   r=   r  r   r   r?   r?   )r?   r?   rU  NN)r!  r   r   r   r   rK   r5   rQ   rP   r   r  )rS   rT   r7  r  r~   r   r*  r   r	  r6   c2_4r   bspl2_4r%  
val_singlec2_22bspl2_22
target2_22s   &&                rW   test_2D_separable_2!TestNdBSpline.test_2D_separable_2	  s   /467B&1!Q$!Q$1*%%B7%%%,	xx(qx1B*rq)"-
||t###*!12	@
 r{  BHHRL"$5		8N$NNNN

6
<WE$)"	$ 

4.R!,"||v%%%WWV2::W6zA

7 ""Sb!HJJ$4$4TU$;;< 	= <

6
<]K$)"	$E 8s   0I c                   . R	OpV UUu. uF*  w  r4V^,          V^,          ^V,          ,           ,          NK,  	  pppV Uu. uF  qfRV,          ,           NK  	  ppV P                  VR7      w  rxp	VR
,          pVP                  WW3^R7      p
Rp\        Wz^R7      pV! V4      p\        WxV	4      ! V4      pVP                  R8X  g   Q h\	        VVP                  V.^,          4      RR7       R# u uppi u upi )r(  y               @ry   r  rz  rz   r{   Nr)  r(  rQ  r0  )r!  r   r   r   r   )rS   rT   r  r~   r   r*  r4   r   r	  r6   r3  r   r4  r%  r5  s   &&             rW   test_2D_separable_2_complex)TestNdBSpline.test_2D_separable_2_complex%
  s    /467B&1!Q$!Q$1*%%B7$*+Fqbd((F+%%%,	6]xx(qx1B*rq)"-
||t###*a0u	> 8+s   0C1C7c                    \         P                  P                  R 4      p^p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          pVP                  VP                  V,
          ^,
          VP                  V,
          ^,
          3R7      p\        W43WRR7      pRp\        V! V4      \        WsV3WR4      RR7       \         P                  . RO. RO3,          p\        V! V4      V Uu. uF  p\        WV3WR4      NK  	  upRR7       R# u upi )	r  r   rz  rz   r{   N)r2   r2   r0   r(  r?   皙?g? @)rK   rR   r  r   r   r  r   r   r   r  r?  )	rS   r   r6   r  r  r5   rV  r  r   s	   &        rW   test_2D_randomTestNdBSpline.test_2D_random8
  s9   ii##E*UU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLKKbggaik27719Q;7K8!)B "Xq45	B UU;"# $B@BC""2h5C"	$Cs   E;
c                :   V P                  4       w  rr4. ROpV UUu. uF*  w  rgV^,          V^,          ^V,          ,           ,          NK,  	  ppp\        WW43R7      p	V	! V4      P                  \        V4      38X  g   Q h\	        V	! V4      VRR7       R# u uppi )ffffff?rz  rz   r{   N)rF  r  )r:   g333333@)r  r  )r$  r   r   ra  r   )
rS   r   r	  kxkyr  r~   r   r*  r+  s
   &         rW   test_2D_mixedTestNdBSpline.test_2D_mixedK
  s    ++-1467B&1!Q$!Q$1*%%B7"RH-Ry3r7+---b	U	, 8s   0Bc                &   V P                  VR 7      w  r#rE. ROp\        W#WE3R7      pRR RR RR ^V,          ^3R ^V,          ^ 3R ^^V,          3R ^ ^V,          3R ^V,          ^V,          3R	 /pVP                  4        Fv  w  rTP                  V UUu. uF  w  rV
! W4      NK  	  uppVP                  R
7      pV! WiR7      p\        WRR7       VP                  V	4      ! V4      p\        WRR7       Kx  	  R F^  p\        \        4      ;_uu_ 4        V! VVR7       RRR4       \        \        4      ;_uu_ 4        VP                  V4       RRR4       K`  	  R# u uppi   + '       g   i     LM; i  + '       g   i     K  ; i)ry   rz  c                 Z    ^V ^,          ,          V^,          ^V,          ,           ,          # r  r>  r~   r   s   &&rW   r  2TestNdBSpline.test_2D_derivative.<locals>.<lambda>[
  s    QTQTAaCZ!8rn   c                 L    ^V ^,          ,          ^V,          ^,           ,          # r  r>  rN  s   &&rW   r  rO  \
  s    QTQqS1W!5rn   c                 L    V ^,          V^,          ^V,          ,           ,          # r  r>  rN  s   &&rW   r  rO  ]
  s    AA!!4rn   c                     ^ # rG  r>  rN  s   &&rW   r  rO  ^
      Arn   c                     ^ # rG  r>  rN  s   &&rW   r  rO  _
  rS  rn   c                     ^ # rG  r>  rN  s   &&rW   r  rO  `
  rS  rn   c                     ^ # rG  r>  rN  s   &&rW   r  rO  a
  rS  rn   c                     ^ # rG  r>  rN  s   &&rW   r  rO  b
  s    qrn   r;   r   rz   r{   NrG  r  r0   r0   )r   r   ))r=   r   r=   r   r0   )	r$  r   itemsrQ   rP   r   r  rG   rI   )rS   rT   r   r	  rH  rI  r  r+  
test_casesr   expected_fnr~   r   expected_valsdirect
via_methodbad_nus   &&               rW   test_2D_derivative TestNdBSpline.test_2D_derivativeT
  sk   ++r+21"RH- 854rT1I~rT1I~"I~"I~rT1R4L.	

  *//1OBJJ/12rtqQ"r2"** ' M
 2%FF> ))"-b1JJEB  2#Fz**bV$ +z**  ( +*	# 3 +****s   E&E,E?,E<?Fc                   \         P                  P                  R 4      p^^r2\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          pVP                  VP                  V,
          ^,
          VP                  V,
          ^,
          3R7      p\         P                  . RO. RO3,          p\        WE3WbV3R7      p\        WE3WbV3R7      p	\        V! V4      V U
u. uF
  q! V
4      NK  	  up
RR7       R# u up
i )r  r   rz  rz   r{   Nr?  r@  )rK   rR   r  r   r   r  r   r?  r   r  r   rS   r   rH  rI  r  r  r5   r  r+  bspl2_0rT   s   &          rW   test_2D_mixed_random"TestNdBSpline.test_2D_mixed_randomz
  s(   ii##E*ABUU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLKKbgglQ."q0@AKBUU;"# $ 2(Ab2bXqH5b	/12rr2	@2s   
E%
c                Z   \         P                  ! ^4      p\         P                  ! ^4      R,           p\        W^,          ^R7      p\        W"^,          ^V,          ,           ^R7      pVP                  R,          VP                  R,          ,          p\	        VP
                  VP
                  3WSP                  VP                  34      pV^,          R,          V^,          ^V,          ,           R,          ,          p\        W3V4      p\        P                  ! W4       U	U
u. uF  w  rW3NK
  	  pp	p
V! V4      p\         P                  ! V4      P                  4       '       d   Q h\        W! V4      RR7       \        VP                  VP                  4      VRR7       R# u up
p	i )r   r(  rz  Nrz   r{   r  r  )rK   rO   r   r5   r   r4   r6   r   r  r	  r   anyr   r   r   )rS   r~   r   spl_xspl_yr	  r   valuesrgir  rV   r  bxis   &            rW   test_tx_neq_tyTestNdBSpline.test_tx_neq_ty
  s5   IIaLIIaL3"1da0"1dQqSjA6WWW 00%''577+R''5771CDQ$AqD1Q3J#88%qff5!*!2!21!89!8qf!892h88C=$$&&&&SW51FLL16F :s   &F'c                   VP                  ^4      pV^,          p\        W#^R7      pV^,          ^V,          ,           p\        W%^R7      pV^,          ^V,          ,           ^,           p\        W'^R7      pVP                  VP                  VP                  3p	VP                  R,          VP                  R,          ,          VP                  R,          ,          p
W^3# )r   rz  r2  )NrU  N)NNrU  r  )rS   rT   r~   r   rV  r  r  y_2rr  r   r	  s   &&         rW   make_3d_caseTestNdBSpline.make_3d_case
  s    IIaLqD +dQqSj"1Q/dQqSj1n"1Q/eeUWWegg&eeM"ggm$%ggm$% qyrn   c                   \         P                  P                  R 4      pVP                  RR7      ^,          w  r#pV^,          V^,          ^V,          ,           ,          V^,          ^V,          ,           ^,           ,          pV P	                  4       w  rgp\        Wg^R7      p	\        W#V4       U
u. uF  qNK  	  pp
V	! V4      pVP                  R8X  g   Q h\        WRR7       R# u up
i )r  r   rz  rz   r{   NrA      rw  )	rK   rR   r  r  rs  r   zipr   r   )rS   r   r~   r   r  r*  t3c3r6   bspl3r   r  r%  s   &            rW   test_3D_separableTestNdBSpline.test_3D_separable
  s    ii##E*++7++a/aAA!$1qs
Q7%%'	"A&Q1&Aa&r||u$$$U3 's   2
C(c                n   V P                  VR 7      w  r#p\        W#^R7      p\        P                  P	                  R4      pVP                  RR7      ^,          w  rxp	\        WxV	4       U
u. uF  qNK  	  pp
VP                  V4      pRR RR RR RR RR /pVP                  4        F{  w  rV UUUu. uF  w  pppV! VVV4      NK  	  ppppVP                  VVP                  R	7      p\        V! WR
7      VRR7       \        VP                  V4      ! V4      VRR7       K}  	  R# u up
i u upppi )ry   rz  r  r   c                     ^V ^,          ,          V^,          ^V,          ,           ,          V^,          ^V,          ,           ^,           ,          # r  r>  r~   r   r  s   &&&rW   r  2TestNdBSpline.test_3D_derivative.<locals>.<lambda>
  s2    q1a4x1a4!A#:'>!Q$1*q.'Qrn   c                     ^V ,          V^,          ^V,          ,           ,          V^,          ^V,          ,           ^,           ,          # r   r>  r  s   &&&rW   r  r  
  s.    q1u1qs
';q!taczA~'Nrn   c                     ^V ,          ^V^,          ,          ^,           ,          V^,          ^V,          ,           ^,           ,          # r  r>  r  s   &&&rW   r  r  
  s.    q1u!Q$
';q!taczA~'Nrn   c                 Z    ^V ,          ^V^,          ,          ^,           ,          ^,          # r  r>  r  s   &&&rW   r  r  
  s    q1u!Q$
';a'?rn   c                     R # r  r>  r  s   &&&rW   r  r  
  s    srn   r;   r   rz   r{   Nrv  )r0   r   r   )r?   r   r   )r?   r0   r   )r?   r0   rA   )r?   r0   rB   )rs  r   rK   rR   r  r  ry  rQ   rZ  rP   r   r  )rS   rT   rz  r{  r6   r|  r   r~   r   r  r   xi_npr  r[  r   r\  xi_yi_zi_r]  s   &&                  rW   test_3D_derivative TestNdBSpline.test_3D_derivative
  s)   %%%,	"A&ii##E*++7++a/aaL)LqL)ZZ QNN?*

  *//1OBMRSUMCc[c37UMSJJ}BJJJGME",m%HE,,R04m%P	  2 * Ts   ,
D+5D0
c                   \         P                  P                  R 4      p^p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          pVP                  VP                  V,
          ^,
          VP                  V,
          ^,
          VP                  V,
          ^,
          3R7      p\        W4V3WbR7      p\        W4V3WbR7      pRp	\        V! V	4      V! V	4      RR7       \         P                  . RO. RO. R	O3,          p	\        V! V	4      V	 U
u. uF
  q! V
4      NK  	  up
RR7       R# u up
i )
r  r   rz  rz   r{   N)r2   r2   r0   r?  r@  g?rF  gffffff?)rK   rR   r  r   r   r  r   r   r  r   r?  )rS   r   r6   r  r  tzr5   rV  spl_0r  rT   s   &          rW   test_3D_randomTestNdBSpline.test_3D_random
  s   ii##E*UU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLKKbggaik27719Q;	!DKEa-BB<0Br7UU;""# $ 	Bb!9b%)b!9F!9s   
G%
c                   \         P                  P                  R 4      p^p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          pVP                  VP                  V,
          ^,
          VP                  V,
          ^,
          VP                  V,
          ^,
          3R7      VP                  VP                  V,
          ^,
          VP                  V,
          ^,
          VP                  V,
          ^,
          3R7      R,          ,           p\        W4V3WbR7      p\        W4V3VP                  VR7      p\        W4V3VP                  VR7      p	\         P                  . RO. RO. R	O3,          p
\        V! V
4      V! V
4      RV	! V
4      ,          ,           RR7       R# )
r  r   r1   rz  rz   r{   Nr?  r@  r  )rK   rR   r  r   r   r  r   r   r  r  r?  r   )rS   r   r6   r  r  r  r5   rV  r  r  r  s   &          rW   test_3D_random_complex$TestNdBSpline.test_3D_random_complex
  s   ii##E*UU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KL[[rwwqy{BGGAIaK1E[F[[rwwqy{BGGAIaK1E[FrIJ a-BB<15BB<15UU;""# $ 	Br
Rr
]2	@rn   
cls_extrapNTcall_extrapc                   V P                  4       w  r4p\        W4^VR7      p. RO. RO. ROrp\        \        P                  WxV	34      w  rxp	\        WxV	4       U
u. uF  qNK  	  pp
V^,          V^,          ^V,          ,           ,          V	^,          ^V	,          ,           ^,           ,          pV! WR7      p\        WRR7       R# u up
i 	rA   )r6   r   r   rz   r{   N)r=   r   )rT  r   r  )r=   g            @rs  r   r}   rK   rQ   ry  r   )rS   r  r  rz  r{  r6   r|  r~   r   r  r   r  r*  r%  s   &&&           rW   test_extrapolate_3D_separable+TestNdBSpline.test_extrapolate_3D_separable
  s     %%'	"A:> abjj1),aQ1&Aa&AA!$1qs
Q7r3U3	 's   
Cr   c                   V P                  4       w  r#pVw  rV\        W#^VR7      p. RO. RO. ROrp\        \        P                  WV
34      w  rp
\        WV
4       Uu. uF  qNK  	  ppV^,          V	^,          ^V	,          ,           ,          V
^,          ^V
,          ,           ^,           ,          pV! WR7      p\        WRR7       R# u upi r  r  )rS   r   rz  r{  r6   r  r  r|  r~   r   r  r   r  r*  r%  s   &&             rW   test_extrapolate_3D_separable_2-TestNdBSpline.test_extrapolate_3D_separable_2  s     %%'	"(
"A:> abjj1),aQ1&Aa&AA!$1qs
Q7r3U3	 's   
C
c                8   V P                  4       w  rp\        W^R7      p. RO. RO. R
Orvp\        \        P                  WVV34      w  rVp\        WVV4       Uu. uF  qNK  	  p	pV^,          V^,          ^V,          ,           ,          V^,          ^V,          ,           ^,           ,          p
V! V	RR7      p\        P                  ! V^ ,          4      '       g   Q h\        P                  ! VR	,          4      '       g   Q h\        V^R	 V
^R	 RR7       R# u upi )rA   rz  Fr   rz   r{   N)r  r0   r   )rT  r   r  r=   )r=   r(  r  )rs  r   r}   rK   rQ   ry  r   r   )rS   rz  r{  r6   r|  r~   r   r  r   r  r*  r%  s   &           rW   #test_extrapolate_false_3D_separable1TestNdBSpline.test_extrapolate_false_3D_separable  s    %%'	"A& nnabjj1),aQ1&Aa&AA!$1qs
Q7ru-xxq	""""xxr
####qfQrl? 's   
Dc           	     |   V P                  4       w  rp\        W^R7      p\        P                  ! R^\        P                  ^^^\        P                  .4      p\        P                  ! R	R^\        P                  ^RR.4      p\        P                  ! R
R^^\        P                  RR.4      p\        WVV4       Uu. uF  qNK  	  p	pV^,          V^,          ^V,          ,           ,          V^,          ^V,          ,           ^,           ,          p
\        P                  ! V4      \        P                  ! V4      ,          \        P                  ! V4      ,          p\        P                  W&   V! V	4      p\        P                  ! W,          4      P                  4       '       g   Q h\        WRR7       R# u upi )rA   rz  r  r  r  rz   r{   Nr  rT  r=   )	rs  r   rK   rQ   rM   ry  r   r   r   )rS   rz  r{  r6   r|  r~   r   r  r   r  r*  r   r%  s   &            rW   test_x_nan_3DTestNdBSpline.test_x_nan_3D-  s<   %%'	"A& JJArvvq!Q78JJCBFFAsC89JJCArvvsC89Q1&Aa&AA!$1qs
Q7xx{RXXa[(288A;6vvrxx%))++++U3 's   >
F9c           	     d   \         P                  P                  R 4      p^^r2\         P                  ! VP	                  ^ ^^R7      4      p\         P
                  V^ ,          3V,          WDR,          3V,          3,          p\         P                  ! VP	                  ^ ^^R7      4      p\         P
                  V^ ,          3V,          WUR,          3V,          3,          pVR,          P                  P                  '       d   Q hVR,          P                  P                  '       d   Q hVP	                  VP                  ^,          V,
          ^,
          VP                  ^,          V,
          ^,
          3R7      pVP                  pVP                  P                  '       d   Q h\         P                  . R	O. R
O3,          p\        VR,          VR,          3WbV3R7      p\        VR,          VR,          3WbV3R7      p	\        V! V4      V U
u. uF
  q! V
4      NK  	  up
RR7       R# u up
i )r  r  NNr?   r   rz  rz   r{   Nr=   r?  r@  )rK   rR   r  r   r  r   flagsc_contiguousr   r'  r?  r   r  r   rd  s   &          rW   test_non_c_contiguous#TestNdBSpline.test_non_c_contiguous?  s   ii##E*ABWWS[[QQR[89UUBqE8B;VIbL01WWS[[QQR[89UUBqE8B;VIbL01c7==-----c7==-----KKbggqj2o1277A:?Q3FGKHCC77'''''UU;"# $ 2c7BsG,a8<bgr#w/2h?b	/12rr2	@2s   H-
c                    V P                  4       w  rp\        W^R7      p\        ^4       F  pRW,          P                  n        K  	  RVP                  n        \        W^R7      pV! R4      V! R4      8X  g   Q hR# )rA   rz  FNrs  )rs  r   r   r  	writeable)rS   rz  r{  r6   r|  r*  bspl3_s   &      rW   test_readonlyTestNdBSpline.test_readonlyX  sl    %%'	"A&qA$)BEKK! "2Q'Y6)#4444rn   c                   V P                  4       w  rp\        P                  ! . RO. RO.4      p\        WV4      P	                  WAV4      p\        P                  ! WAW3V.4      pVP
                  ^ ,          VP
                  ^ ,          8X  g   Q h\        VP                  4       VP                  4       RR7       \        \        4      ;_uu_ 4        \        P                  ! . ROW.^,          4       RRR4       \        \        RR7      ;_uu_ 4        \        P                  ! ^^..W.^,          4       RRR4       R#   + '       g   i     LV; i  + '       g   i     R# ; i)r0   gؗҜ<r{   NzData and knots*rE  rs  )rB   r   r   )
rs  rK   rQ   r   rb  r   r   r  rG   rI   )rS   rz  r{  r6   r  dmdm1s   &      rW   test_design_matrix TestNdBSpline.test_design_matrixd  s    %%'	ZZI./rq!//:%%bqQi8xx{bhhqk)))

ckkm%@:&&##Ir3q59 ' :->??##aVHb#a%8 @? '& @??s   "E#EE	E%	c                    \         P                  P                  R 4      p^p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\         P                  ^ ^ ^ ^ \         P                  ! VP                  ^R7      4      ^,          ^^^^3	,          pVP                  VP                  V,
          ^,
          VP                  V,
          ^,
          VP                  V,
          ^,
          3R7      p\        W4V3WbR7      pR p\        ^
W4       R# )r  r   rz  c                 V    \         P                  . RO. RO. RO3,          pV! V4       R# )r0   Nr?  r@  r  )rK   r?  )r   rV  r  s   && rW   r  1TestNdBSpline.test_concurrency.<locals>.worker_fn}  s&    {&&' (B Grn   N)	rK   rR   r  r   r   r  r   r   r(   )	rS   r   r6   r  r  r  r5   rV  r  s	   &        rW   r  TestNdBSpline.test_concurrencys  s%   ii##E*UU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLUU1aArwws{{{':;a?Aq!KLKKbggaik27719Q;	!DKEa-	 	 I3rn   r>  )FT)TN)"r?  r@  rA  rB  r  rK   r!  r$  r-  r9  r<  rC  rJ  ra  rf  ro  rs  r}  r  r  r  rb   r  r  r  r  r  r  r  r  r  r  rC  r  r  s   @rW   r  r  	  s    B, !   " &*9X)$V>&$&,$)L@ G( ! &4Q0G&@& [[\D$<8[[]T4L94 : 94 [[X|'DE4 F4 @ 4$@2
594 4rn   r  c                   P  a  ] tR tRt o R tR t]P                  P                  R. RO4      R 4       t	R t
R tR tR	 t]P                  P                  R
]P                  ]P                   .4      R 4       tR t]P                  P                  R. RO4      R 4       tR tRtV tR# )
TestMakeNDi  c                   \         P                  ! ^4      p\         P                  ! ^4      R,           pVR,          ^,          V^,          ^V,          ,           R,          ,          p\        P                  ! W4       UUu. uF  w  rEWE3NK
  	  ppp\	        W3V^R7      p\        V! V4      VP                  4       RR7       \        W^,          ^R7      p\        W"^,          ^V,          ,           ^R7      p	VP                  R,          V	P                  R,          ,          p
\        WP                  R^ R7       ^ RI	H
p V! W3VR	R
7      p\        V! V4      V! V4      RR7       R# u uppi )r   r   Nrz  r[   r{   r  r\   )r   linearr0  rz   r  r  )rK   rO   r  r	  r)   r   ravelr   r5   scipy.interpolater   )rS   r~   r   rl  r  rV   r  r   rj  rk  r	  RGIrm  s   &            rW   test_2D_separable_simple#TestMakeND.test_2D_separable_simple  s   IIaLIIaL37Q!Q$1*g!66!*!2!21!89!8qf!89A66Q/R&,,.u= #1da0"1dQqSjA6WWW 00FFQ7 	E1&&2Bb6 :s    E)c                L   \         P                  ! ^4      p\         P                  ! ^4      p\        P                  ! W4       UUu. uF  w  r4W43NK
  	  pppVR,          ^,          V^,          ^V,          ,           R,          ,          p\         P                  ! WfWf34      p\        W3V^\        P                  R7      pV! V4      p	\         P                  ! WfWf34      P                  \        4      p
V	P                  R8X  g   Q h\        V	P                  ^^^4      V
RR7       VP                  R4      p\        W3V^\        P                  R7      pV! V4      p	V	P                  R	8X  g   Q h\        V	P                  ^^^^4      V
P                  R4      RR7       R# u uppi )
r   Nr6   solverrz   r{   r  r  )$   rB   r1  )r  r?   r?   )rK   rO   r  r	  r@  r)   sslspsolverX  r]  r   r   r   )rS   r~   r   r  rV   r  rl  values4r   r%  r*  values22s   &           rW   test_2D_separable_trailing_dims*TestMakeND.test_2D_separable_trailing_dims  sR   IIaLIIaL!*!2!21!89!8qf!89 7Q!Q$1*g!66))VV<=A67aDbFF;<CCEJ||w&&&q!Q/U	, ??<0A68qEb||z)))q!Q2|45	B' :s   F r6   c                   \         P                  ! ^4      p\         P                  ! ^4      R,           p\        P                  ! W#4       UUu. uF  w  rEWE3NK
  	  pppV^,          R,          V^,          ^V,          ,           R,          ,          p\	        W#3Wq\
        P                  R7      p\        V! V4      VP                  4       RR7       R# u uppi )r   r(  Nr  r[   r{   r  r  )	rK   rO   r  r	  r)   r  r  r   r  )	rS   r6   r~   r   r  rV   r  rl  r   s	   &&       rW   rJ  TestMakeND.test_2D_mixed  s     IIaLIIaL3!*!2!21!89!8qf!89Q$AqD1Q3J#88A66s{{CR&,,.u=	 :s   Cc                ~   \         P                  ! ^4      p\         P                  ! ^4      R,           p\         P                  VR&   VR,          ^,          V^,          ^V,          ,           R,          ,          p\        \        4      ;_uu_ 4        \        W3V^R7       RRR4       R#   + '       g   i     R# ; i)r   r   Nrz  r=   r  r  )rK   rO   rM   rG   rI   r)   )rS   r~   r   rl  s   &   rW   test_2D_nansTestMakeND.test_2D_nans  sy    IIaLIIaL3"7Q!Q$1*g!66:&&!, '&&&s   B++B<	c           	         \         P                  ! . RO4      p\         P                  ! . RO4      p\         P                  ! . RO. RO. RO. RO. RO. RO.4      pWV3# )r   )r   rD   rE   rF   r  r  )r0   r?   r0   r?   r0   r0   )r0   r?   rA   r?   r0   r0   )r0   r?   r?   r?   r0   r0   )rK   rs  )rS   r~   r   r  s   &   rW   _get_sample_2d_dataTestMakeND._get_sample_2d_data  sP    HH./HH./HH""""""	
 Qwrn   c                    V P                  4       w  rp\        W3V^R7      p\        W3VRR7      p\        P                  ! . RO. RO.4      P
                  p\        V! V4      V! V4      RR7       R# )	r0   rz  r  r0  rz   r{   Nr0   gffffff@g333333@r   ffffff
@333333?rA   r0   r  r  rF   r  r2   rA   r  r)   r   rK   rs  r'  r   rS   r~   r   r  r   rm  r  s   &      rW   test_2D_vs_RGI_linear TestMakeND.test_2D_vs_RGI_linear  sk    **,aA61*%qfaAXX668 99: 	 	R#b'6rn   c                   V P                  4       w  rp\        W3V^\        P                  R7      p\	        W3VRR7      p\
        P                  ! . RO. RO.4      P                  p\        V! V4      V! V4      RR7       R# )	rA   r  cubic_legacyr0  rz   r{   Nr  r  	r  r)   r  r  r   rK   rs  r'  r   r  s   &      rW   test_2D_vs_RGI_cubicTestMakeND.test_2D_vs_RGI_cubic  sq    **,aA61#++>%qfaGXX668 99: 	 	R#b'6rn   r  c                    V P                  4       w  r#p\        W#3V^VRR7      p\        W#3VRR7      p\        P                  ! . R	O. R
O.4      P
                  p\        V! V4      V! V4      RRR7       R# )rA   ư>)r6   r  r^   r  r0  rz   r   r\   Nr  r  r  )rS   r  r~   r   r  r   rm  r  s   &&      rW   test_2D_vs_RGI_cubic_iterative)TestMakeND.test_2D_vs_RGI_cubic_iterative  ss     **,aA61&tD%qfaGXX668 99: 	 	R#b'DArn   c                   V P                  4       w  rp\        W3V^\        P                  R7      p\	        W3VRR7      p\
        P                  ! . RO. RO.4      P                  p\        V! V4      V! V4      RR7       R# )	r   r  quintic_legacyr0  rz   r{   Nr  r  r  r  s   &      rW   test_2D_vs_RGI_quintic!TestMakeND.test_2D_vs_RGI_quintic  sr    **,aA61#++>%qfa8HIXX668 99: 	 	R#b'6rn   zk, methc                   \         P                  P                  R 4      p\         P                  ! VP	                  ^R7      4      p\         P                  ! VP	                  ^R7      4      p\         P                  ! VP	                  ^R7      4      pVP	                  R
R7      p\        WEV3Wq\        P                  R7      p\        WEV3WrR7      p	\         P                  P	                  RRRR7      p
\        V! V
4      V	! V
4      RR7       R	# )i@ r   r  r0  gffffff?rB  r  rz   r{   NrJ  )rw  rA   )
rK   rR   r  cumsumr  r)   r  r  r   r   )rS   r6   methrndmr~   r   r  rl  r   rm  r  s   &&&        rW   test_3D_random_vs_RGI TestMakeND.test_3D_random_vs_RGI  s     yy$$V,IIdlll*+IIdlll*+IIdlll*+9-A!9f#++F%qQiEYY3Sw?R#b'6rn   c           	     t   V P                  4       w  rpR ^/p\        \        RR7      ;_uu_ 4        \        W3V3R^/VB  RRR4       \        \        RR7      ;_uu_ 4        \        W3\        P
                  ! W334      3R^/VB  RRR4       R#   + '       g   i     LY; i  + '       g   i     R# ; i)maxiterr  rE  r6   N)r  rG   rI   r)   rK   r@  )rS   r~   r   r  solver_argss   &    rW   test_solver_err_not_converged(TestMakeND.test_solver_err_not_converged  s    **,a !n:X666Q6+6 7 :X66		1& 1FQF+F 76 76 766s   B#&B&B#	&B7	r>  N))rA   rA   rX  )rA   r0   )r0   rA   rW  ))r0   r  )rA   r  )r   r  )r?  r@  rA  rB  r  r  rb   r  r  rJ  r  r  r  r  r  gmresgcrotmkr  r  r  r  rC  r  r  s   @rW   r  r    s     7(B4 [[S"JK> L>- 77 [[X		3;;'?@B AB7 [[N77G Grn   r  c                   \   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tRtV tR# )
TestFpcheci   c                   ^p\         P                  ! ^4      P                  ^^4      p\         P                  ! ^4      p\        P                  ! \
        RR7      ;_uu_ 4        \        P                  ! W2V4       RRR4       \        P                  ! \
        RR7      ;_uu_ 4        \        P                  ! W#V4       RRR4       R#   + '       g   i     LV; i  + '       g   i     R# ; i)r0   z1D sequencerE  N)rK   rO   r   rb   r   rI   _bfpcheckrS   r6   r4   r~   s   &   rW   test_1D_x_tTestFpchec.test_1D_x_t#  s    IIbM!!!Q'IIbM]]:];;JJqQ < ]]:];;JJqQ <; <; <;;s   #C	'C	C	C-	c                   ^p^V^,           ,          ^,
          pV^,           p\         P                  ! V4      p\         P                  ! V4      p\        P                  ! WTV4      ^
8X  g   Q h\        P
                  ! \        RR7      ;_uu_ 4        \        P                  ! WTV4       RRR4       ^V^,           ,          ^,           pW!,
          ^,
          p\         P                  ! V4      p\         P                  ! V4      p\        P                  ! WTV4      ^
8X  g   Q h\        P
                  ! \        RR7      ;_uu_ 4        \        P                  ! WTV4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rA   z	Need k+1*rE  N)	rK   rO   dfitpackfpchecrb   r   rI   r  r  )rS   r6   rU   r  r4   r~   s   &     rW   test_condition_1TestFpchec.test_condition_1.  s   AY]FIIaLIIaLqQ'2---]]:[99JJqQ : qsGaKEAIIIaLIIaLqQ'2---]]:[99JJqQ :9 :9 :99s   E'E:'E7	:F	c                (   ^p^ .V^,           ,          ^.,           ^.V^,           ,          ,           p. ROp\         P                  ! W2V4      ^ 8X  g   Q h\        P                  ! W2V4      e   Q hVP	                  4       pV^ ,          VR&   \         P                  ! W4V4      ^8X  g   Q h\
        P                  ! \        RR7      ;_uu_ 4        \        P                  ! W4V4       RRR4       VP	                  4       pVR,          V^ &   \         P                  ! W4V4      ^8X  g   Q h\
        P                  ! \        RR7      ;_uu_ 4        \        P                  ! W4V4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rA   NzLast k knots*rE  zFirst k knots*)r0   r?   rA   rB   r  r=   r  r  r  r  r9  rb   r   rI   )rS   r6   r4   r~   tts   &    rW   test_condition_2TestFpchec.test_condition_2C  s'    C1IOqc1Q3i'qQ'1,,,zz!"***VVXA2qa(B...]]:_==JJqa  > VVX21qa(B...]]:-=>>JJqa  ?> >= ?>>s   E-F -E=	 F	c                0   ^p^ .V^,           ,          ^^.,           ^.V^,           ,          ,           p. ROp\         P                  ! W2V4      ^ 8X  g   Q h\        P                  ! W2V4      e   Q h^ .V^,           ,          ^^.,           ^.V^,           ,          ,           p\         P                  ! W2V4      ^8X  g   Q h\        P
                  ! \        RR7      ;_uu_ 4        \        P                  ! W2V4       RRR4       R#   + '       g   i     R# ; i)rA   NzInternal knots*rE  r0   r?   rA   r  rB   r  )r  r  r  r  rb   r   rI   r   s   &   rW   test_condition_3TestFpchec.test_condition_3Y  s    C1IA!ac*"qQ'1,,,zz!"***C1IA!ac*qQ'2---]]:->??JJqQ @???s   "DD	c                   ^p^ .V^,           ,          ^.V^,           ,          ,           p. ROp\         P                  ! W2V4      ^ 8X  g   Q h\        P                  ! W2V4      e   Q hVP	                  4       pV^ ,          V^ &   \         P                  ! WBV4      ^ 8X  g   Q h\        P                  ! W2V4      e   Q hVP	                  4       pV^ ,          ^,
          V^ &   \         P                  ! WBV4      ^(8X  g   Q h\
        P                  ! \        RR7      ;_uu_ 4        \        P                  ! WBV4       RRR4       VP	                  4       pVR,          ^,           VR&   \         P                  ! WBV4      ^(8X  g   Q h\
        P                  ! \        RR7      ;_uu_ 4        \        P                  ! WBV4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rA   NzOut of bounds*rE  r  r=   r	  )rS   r6   r4   r~   rj   s   &    rW   test_condition_4TestFpchec.test_condition_4f  sr    C1IQqS	!"qQ'1,,,zz!"***VVX!1ra(A---zz!"***VVX!q1ra(B...]]:-=>>JJra  ? VVX22ra(B...]]:-=>>JJra  ?> ?> ?>>s   !G&GG	G,	c                   ^p. ROp. ROp\         P                  ! W2V4      ^28X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \
        P                  ! W2V4       RRR4       . ROp\         P                  ! W2V4      ^28X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \
        P                  ! W2V4       RRR4       R#   + '       g   i     Lx; i  + '       g   i     R# ; i)r0   Schoenberg-Whitney*rE  N)r   r   r0   r?   r?   )rA  rA  rA  )r   r   r   r  r  rb   r   rI   r  r  r   s   &   rW   test_condition_5_x1xm TestFpchec.test_condition_5_x1xm  s    qQ'2---]]:-BCCJJqQ D qQ'2---]]:-BCCJJqQ DC DC
 DCCs   C3C(C%	(C9	c                    ^p. ROpRR.p\         P                  ! W2V4      ^ 8X  g   Q h\        P                  ! W2V4      e   Q hR# )r0   r   g333333?N)r   r   r0   r0   )r  r  r  r  r   s   &   rW   test_condition_5_k1TestFpchec.test_condition_5_k1  sE    #JqQ'1,,,zz!"***rn   c                   ^p^ .V^,           ,          ^.,           ^.V^,           ,          ,           p^.^,          p\         P                  ! W2V4      ^28X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \
        P                  ! W2V4       RRR4       ^ .V^,           ,          ^.,           ^.V^,           ,          ,           p^.^,          p\         P                  ! W2V4      ^28X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \
        P                  ! W2V4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)rA   r  rE  Nr  r   s   &   rW   test_condition_5_1TestFpchec.test_condition_5_1  s    C1IOqc1Q3i'CEqQ'2---]]:-BCCJJqQ D C1IOqc1Q3i'CEqQ'2---]]:-BCCJJqQ DC DC DCCs   >D;E;E	E	c                   ^p^ .V^,           ,          ^^.,           ^.V^,           ,          ,           pR.^,          ^.,           p\         P                  ! W2V4      ^28X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \
        P                  ! W2V4       RRR4       R.^,          ^^.,           p\         P                  ! W2V4      ^ 8X  g   Q h\
        P                  ! W2V4      e   Q hR#   + '       g   i     L^; i)rA   rA  r  rE  Nr  r   s   &   rW   test_condition_5_2TestFpchec.test_condition_5_2  s    C1IA!ac*E!GqcMqQ'2---]]:-BCCJJqQ D E!Gq!fqQ'1,,,zz!"*** DCs   C55D	c                   ^p. ROp. ROp\         P                  ! W2V4      ^28X  g   Q h\        P                  ! \        RR7      ;_uu_ 4        \
        P                  ! W2V4       RRR4       R#   + '       g   i     R# ; i)r0   r  rE  N)	r   r   r?   rA   rB   r   r   r   r   )r0   r0   r0   @r#  r#  r  r  r   s   &   rW   test_condition_5_3TestFpchec.test_condition_5_3  sZ    ')qQ'2---]]:-BCCJJqQ DCCCs   A//B 	r>  N)r?  r@  rA  rB  r  r  r  r  r  r  r  r  r   r$  rC  r  r  s   @rW   r  r     s<     	  *!, !> + +   rn   r  c                   \         P                  ! WW")  4      p\        \        V4      ^,
          4       Uu. uF(  qSWE,          WE^,           ,           P	                  4       NK*  	  ppW4^R ,          p\        \        V4      4       FA  pWu,          ^,          pWe;;,          V,          uu&   We^,           ;;,          V,          uu&   KC  	  VR;;,          VR,          ,          uu&   \        \	        V4      \	        V4      RR7       Wd3# u upi )z)Split the knot interval into "runs".
    r[   r{   r=   )rK   r  r   ra  r  r   )	r~   r4   r6   	residualsr  r*  fpartscarriescarrys	   &&&&     rW   _splitr+    s     
aG	$B6;CGAI6FG6Fb1g&**,6FFG1R!G3w< 
Q	U	su !
 2J)B-JCKYe<: Hs   .D
c                   \        WW#4      w  rERpRp\        \        V4      4       F?  pWX^,           ,          WX,          ,
          ^8  g   K&  WH,          V8  g   K5  TpWH,          pKA  	  VR8X  d   \        R4      hWV,          WV^,           ,          ,           ^,           ^,          p	W	,          p
\        P
                  ! W4      p\        P                  VRV WVR 3,          pV# )z Insert a new knot given reduals.z5Internal error, please report it to SciPy developers.Nig}Ô%I)r+  r   ra  rI   rK   r  r   )r~   r4   r6   r'  r(  r  idx_max	fpart_maxr*  idx_newknotnew_knotidx_tt_news   &&&&         rW   	_add_knotr3    s    a+JF GI3v;c7RU?Q69y#8G	I  
 $PQQ ;AI.2q8K~HOOA(EEE!FU)Xy01ELrn   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]P                  P                  R. RO4      ]P                  P                  R. RO4      R 4       4       tR tR tRtV tR# )TestGenerateKnotsi  c                8   \         P                  ! ^\        R7      pV^,          R^V,           ,          ,           p^p\         P                  ! R.V^,           ,          R.V^,           ,          ,           4      p\	        WW4R7      pV! V4      V,
          ^,          p^ RIHp VP                  WW64      p\        WW64      p	\        WRR7       \	        WW8R7      p
V
! V4      V,
          ^,          pVP                  WW;4      p\        WW;4      p\        WRR7       R	# )
rK  r;   r2   rC   r  )r6   r4   _fitpack_repror[   r{   N)
rK   rO   r]  rs  r   r  r8  add_knotr3  r   )rS   r~   r   r6   r4   rV  r'  _frnew_tnew_t_pyspl2
residuals2new_t2	new_t2_pys   &             rW   test_split_add_knot%TestGenerateKnots.test_split_add_knot  s    IIau%qD2q1u:HHbT1Q3Z2$!*,-aa-VaZ!O	;Q10Q10e4 qq21gkA%
a6a6	6rn   r6   c           	     H   VP                  ^VP                  R7      pVP                  W2P                  ,          ^,          4      p\	        \        W4V^ R7      4      R,          p\        W4V^ R7      ^ ,          pVP                  WbP                  R7      p\        WVRR7       R# )rK  r;   r6   r  r[   r{   Nr=   )	rO   rP   r  r  r  r$   r   rQ   r   )rS   r6   rT   r~   r   r4   r
  s   &&&    rW   test_s0TestGenerateKnots.test_s0  sy    IIarzzI*FF1UU719Q/04AA#A&ZZ**Z-E*rn   c           	     
   ^
pVP                  W!P                  R7      pV^,          p\        \        W4^^ R7      4      pVP	                  \        \        P                  ! V4      ^4      4      p\        VR,          VRR7       R# )r  r;   rD  r[   r{   Nr=   )rO   rP   r  r$   rQ   r   rK   r   rS   rT   rU   r~   r   knotsrk   s   &&     rW   	test_s0_1TestGenerateKnots.test_s0_1  sd    IIazzI*qD^AA34::k"**Q-;<b	8%8rn   c           	         ^pVP                  V4      pV^,          p\        \        W4^^ R7      4      pVP                  \	        \
        P                  ! V4      ^4      4      p\        VR,          VRR7       R# )   rD  r[   r{   Nr=   )rO   r  r$   rQ   r   rK   r   rH  s   &&     rW   test_s0_n20TestGenerateKnots.test_s0_n20  s]    IIaLqD^AA34::k"**Q-;<b	8%8rn   c                    \         P                  ! ^
4      pV^,          p\        \        4      ;_uu_ 4        \	        \        W^^ ^
R7      4       RRR4       R#   + '       g   i     R# ; i)r  r6   r  nestN)rK   rO   rG   rI   r  r$   rS   r~   r   s   &  rW   test_s0_nestTestGenerateKnots.test_s0_nest&  sE    IIbMqD:&&QR89 '&&&s   AA+	c           	     0   VP                  ^VP                  R7      pVP                  V\        P                  ,          ^,          4      p^p\        \        W#VRR7      4      p. RO. RO. R	O. R
O. RO.pV Uu. uF  qqP                  WqP                  R7      NK   	  pp\        V4      \        V4      8X  g   Q h\        WV4       F  w  r\        WRR7       K  	  \        W#VRR7      w  p p
\        VR,          VP                  V4      RR7       R# u upi )aY  
        To generate the `wanted` list below apply the following diff and rerun
        the test. The stdout will contain successive iterations of the `t`
        array.

$ git diff scipy/interpolate/fitpack/fpcurf.f
diff --git a/scipy/interpolate/fitpack/fpcurf.f b/scipy/interpolate/fitpack/fpcurf.f
index 1afb1900f1..d817e51ad8 100644
--- a/scipy/interpolate/fitpack/fpcurf.f
+++ b/scipy/interpolate/fitpack/fpcurf.f
@@ -216,6 +216,9 @@ c  t(j+k) <= x(i) <= t(j+k+1) and store it in fpint(j),j=1,2,...nrint.
         do 190 l=1,nplus
 c  add a new knot.
           call fpknot(x,m,t,n,fpint,nrdata,nrint,nest,1)
+          print*, l, nest, ': ', t
+          print*, "n, nmax = ", n, nmax
+
 c  if n=nmax we locate the knots as for interpolation.
           if(n.eq.nmax) go to 10
 c  test whether we cannot further increase the number of knots.
        r;   r   rD  r[   r{   N)rC   rC   rC   rC   r  r  r  r  )	rC   rC   rC   rC   rF   r  r  r  r  
rC   rC   rC   rC   rD   rF   r  r  r  r  )rC   rC   rC   rC   rD   rF   r  r  r  r  r  )rC   rC   rC   rC   rD   rE   rF   r  r   r  r  r  r=   )rO   rP   r  rK   r  r  r$   rQ   ra  ry  r   r   )rS   rT   r~   r   r6   rI  wantedwantr4   r
  r   s   &&         rW   test_s_switchTestGenerateKnots.test_s_switch-  s    . IIarzzI*FF1RUU719^AA6726:>A	
 BHH**T*4H5zS[((('EAA. ( d+1ab	2::a=u= Is   9$Dc                `    \        \        ^4      4      p\        WR^R7      p\        V4       R# )rK  r  )r  r6   N)r  r   r$   next)rS   r~   gens   &  rW   r  !TestGenerateKnots.test_list_inputY  s$    qNQSA.S	rn   c                   VP                  ^VP                  R7      pVP                  W!P                  ,          ^,          4      pRp\	        \        W#^V^
R7      4      p\        VR,          VP                  . R	OVP                  R7      RR7       \        \        4      ;_uu_ 4        \	        \        W#^^R7      4       RRR4       R#   + '       g   i     R# ; i)
rK  r;   r   rQ  r[   r{   )r6   rR  Nr=   rW  )
rO   rP   r  r  r  r$   r   rQ   rG   rI   )rS   rT   r~   r   r  rI  s   &&    rW   	test_nestTestGenerateKnots.test_nest_  s    IIarzzI*FF1UU719^AA<="IJJ?rzzJR	
 :&&23 '&&&s   )CC	c                   \         P                  ! ^4      p\         P                  ! V\         P                  ,          ^,          4      p\	        \
        4      ;_uu_ 4        \        \        W\         P                  ! ^4      R7      4       RRR4       \	        \
        4      ;_uu_ 4        \        \        W\         P                  ! ^4      ) R7      4       RRR4       R#   + '       g   i     L]; i  + '       g   i     R# ; i)rK  r:  N)	rK   rO   r  r  rG   rI   r  r$   r  rS  s   &  rW   r<  TestGenerateKnots.test_weightsp  s    IIaLFF1RUU719:&&		"67 ' :&&45 '& '& '&&s    +C *,C3 C0	3D	nptsr  c           	        \         P                  P                  R 4      p^
\         P                  ! VP	                  VR7      4      ,          p\         P
                  ! V\         P                  ,          ^
,          4      \         P                  ! V^,
          ^,          ) 4      ,           p^p\        WEWaR7      ^ ,          p\        \        WEWaR7      4      R,          p\        WRR7       R# )r  r   rD  r[   r{   Nr=   )rK   rR   r   r   r  r  r  expr   r  r$   r   )	rS   r  rf  r  r~   r   r6   r4   r
  s	   &&&      rW   test_vs_splrep TestGenerateKnots.test_vs_splrepz  s     yy$$U+rwwt|||.//FF1RUU72:!A#	!2211"1%.01"5E*rn   c           	     f   ^p\         P                  ! V4      pV^,          p\        \        W#^RR7      4      p\        P
                  ! \        4      ;_uu_ 4       p\        W#^RR7      pRRR4       \        X4      ^8X  g   Q h\        VR,          X^ ,          4       R#   + '       g   i     L>; i)   Jz5rD  Nr=   )
rK   rO   r  r$   rb   warnsRuntimeWarningr   ra  r   )rS   rU   r~   r   rI  r  ra   s   &      rW   test_s_too_small"TestGenerateKnots.test_s_too_small  s    IIaLqD ^AA78\\.))Qe,C *1v{{b	3q6* *)s   B  B0	c                    \        . RO. RO. RO^R7      p\        P                  ! \        RR7      ;_uu_ 4        \	        V4       RRR4       R#   + '       g   i     R# ; i)rC   )r:  r  zweights are zerorE  N)rC   r2   rD   rE   )rF   r  r  r  )rC   rC   rC   rC   )r$   rb   r   rI   r  )rS   r^  s   & rW   test_zero_weights#TestGenerateKnots.test_zero_weights  s;    ]M]aP]]:-?@@I A@@@s   AA!	r>  Nr   )   2   r   )r  {Gz?r   )r?  r@  rA  rB  rA  rb   r  r  rE  rJ  rN  rT  rZ  r  ra  r<  ri  rp  rs  rC  r  r  s   @rW   r5  r5    s     70 [[S/2+ 3+99:*>X4"6 [[V]3[[S.1+ 2 4+"+ rn   r5  c                *   V P                   ^ ,          pWV,
          ^,
          ,          W,          ,
          pV^V,          ,
          ^,
          pW^,           W!,
          ^,
           p\        P                  ! V^4      pVR;;,          R,          uu&   VR;;,          R,          uu&   \        V \        P                  ! W!,
          ^,
          4      V4      ! WaR7      p\        P
                  ! V^,
          VP                   ^,          3\        R7      p\        ^ VP                   ^ ,          ^4       F.  p	WyR3,          Wy^,           R3,          ,
          W^,          R3&   K0  	  WV,          V,          \        P                  ! V4      ,          ,          pV# )zStraitforward way to compute the discontinuity matrix. For testing ONLY.

This routine returns a dense matrix, while `_fitpack_repro.disc` returns
a packed one.
r  r   :r0   Nr?   r   r;   rU  )
r   rK   rq  r   r`  emptyr]  r   r!  	factorial)
r4   r6   rU   deltanrintr  tiir  matrr*  s
   &&        rW   
disc_naiver    s    	

A!eaiL14E!GaKE	
Q3qs1uB
))B
CHHII266!%!)$a(3A88U1Waggaj)7D1aggaj!$Q$!aCF)+T1W % 	5[1t~~a000DKrn   c                   4   a  ] tR tRt o RtRR ltR tRtV tR# )F_densei  zdThe r.h.s. of ``f(p) = s``, an analog of _fitpack_repro.F
Uses full matrices, so is for tests only.
Nc                   Wn         W n        W0n        W@n        Vf   \        P
                  ! V\        R7      MTV n        Wpn        V P                  P                  ^8X  g   Q h\        V\        P                  ! VP                  ^ ,          V,
          ^,
          4      WGR7      ! V4      pWP                  R,          ,          V n        ^ RIHp	 \!        V	P#                  W44      !  P%                  4       V n        VP                  ^8X  g   Q hW P                  ,          p
\        P(                  V
\        P*                  ! V P&                  P                  ^ ,          4      3,          V n        WPn        R # )Nr;   r   r7  r  )r~   r   r4   r6   rK   ru   r]  r:  r   r7  r   r`  r   a_denser  r8  rw  discr  b_denser   rt  r   r  )rS   r~   r   r4   r6   r  r:  r   r  r:  r   s   &&&&&&&&   rW   rz  F_dense.__init__  s    12au-&vv{{a !RVVAGGAJNQ$67TUVW0;#SXXa^4<<> vv{{Z%%BHHT\\%7%7%:;;<rn   c                V   \         P                  ! V P                  V P                  V,          34      p^ RIHpHp V! VRR7      w  rVVP                  V P                  ,          pVP                  ^,          pV! VRV1RV13,          VRV 4      p	\        V P                  WP                  V P                  R7      p
\         P                  ! V P                  ^,          V
! V P                   4      V P"                  ,
          ^,          ,          4      pWn        WP&                  ,
          # )r   )r,  r  economic)r  Nr   )rK   vstackr  r  scipy.linalgr,  r  r'  r   r   r   r4   r6   r   r  r:  r~   r   rV  r  )rS   r1  abr,  r  r  r  qyry  r5   rV  fps   &&          rW   r  F_dense.__call__  s    YYdllQ&678 	+":&SS477]WWQZ!CRC"H+r#2w'dffaT5E5EFVVDFFAITVVtvv!5 99:FF{rn   )r  r  r   r6   r  rV  r4   r:  r~   r   r   )NT)	r?  r@  rA  rB  r  rz  r  rC  r  r  s   @rW   r  r    s     . rn   r  c                     a  ] tR tRt o Rt]3R ltR tR t]	P                  P                  R. RO4      R 4       tR t]	P                  P                  R. RO4      R	 4       t]	P                  P                  R
 4       t]	P                  P                  R. RO4      R 4       tR t]	P                  P                  RRR.4      ]	P                  P                  R. RO4      R 4       4       t]	P                  P                  RRR.4      R 4       t]	P                  P                  RRR.4      ]	P                  P                  R. RO4      R 4       4       t]	P                  P                  R. RO4      ]	P                  P                  R. RO4      R 4       4       t]	P                  P                  R. RO4      ]	P                  P                  R. RO4      R 4       4       tRtV tR# )_TestMakeSplrepBasei  Nc                    V P                   R 8X  d@   VP                  ^ ^\        P                  ,          ^
4      pVP	                  V4      pRpW#V3# VP                  ^ ^^4      pVP	                  VR,          ^,          4      ^,          pRpW#V3# )r   gq@H&?gQ	@)r^  rh   rK   r  r  )rS   rT   r~   r   r  s   &&   rW   	_get_xykt_TestMakeSplrepBase._get_xykt  s~    <<:%Aqw+AAA7NAq"%A$
#Q&AA7Nrn   c                `	   \         P                  ! ^ ^
^4      p\         P                  ! ^ ^
^4      p\        \        4      ;_uu_ 4        \	        WV P
                  R7       RRR4       \        \        4      ;_uu_ 4        \	        ^^RV P
                  R7       RRR4       \        \        4      ;_uu_ 4        \         P                  ! VP                  ^^^34      p\	        WRV P
                  R7       RRR4       \         P                  ! ^4      p\        \        4      ;_uu_ 4        \	        W^,          VRV P
                  R7       RRR4       \         P                  ! ^4      ) p\        \        4      ;_uu_ 4        \	        W^,          VRV P
                  R7       RRR4       \         P                  ! VP                  ^ ,          ^34      p\        \        4      ;_uu_ 4        \	        W^,          VRV P
                  R7       RRR4       \        \        4      ;_uu_ 4        \	        VRRR
1,          V^,          RV P
                  R7       RRR4       \        \        4      ;_uu_ 4        \	        W^,          RRV P
                  R7       RRR4       \        \        4      ;_uu_ 4        \	        W^,          R
V P
                  R7       RRR4       \        \        4      ;_uu_ 4        \	        W^,          ^^RV P
                  R7       RRR4       \        \        4      ;_uu_ 4        \	        W^,          ^ ^V P
                  R	7       RRR4       \        \        4      ;_uu_ 4        \	        \         P                  ! ^4      \         P                  ! ^	4      RV P
                  R7       RRR4       R#   + '       g   i     ELi; i  + '       g   i     ELD; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELw; i  + '       g   i     EL"; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELh; i  + '       g   i     EL<; i  + '       g   i     R# ; i)r   r  Nr  r  r^  )r:  r  r^  r:   r6   r  r^  )r6   rR  r  r^  )r  rR  r^  r=   )rK   rh   rG   rI   r%   r^  r  r   r   rH   rO   rS   r~   r   r:  s   &   rW   test_input_errors%_TestMakeSplrepBase.test_input_errors  s   KK2r"KK2r":&&dll3 ' :&&1T\\: ' :&&Aq)*AT\\: '
 GGBK:&&a41T\\B ' WWR[L:&&a41T\\B ' GGQWWQZO$:&&a41T\\B ' :&&$B$AdllC ' 9%%a43#t||D & :&&a42t||< ' :&&a411T\\J ' :&&a412t||D ' :&&		!biilc4<<P '&a '&& '&& '&& '&&
 '&&
 '&& '&& &%% '&& '&& '&& '&&s   O ?O8=O(*!O<!P*!P$*+P84!Q4 Q 3"Q44!R4AR O	O%	(O9	<P	P!	$P5	8Q		Q	 Q1	4R	R	R-	c           
     x   \        \        WW4V P                  R 7      4      R,          p\        WW4V P                  R 7      p\        WWSW@P                  R7      p\	        VP
                  VP
                  RR7       \	        VP                  VP                  RR7       VP                  VP                  8X  g   Q hR# )r  )r4   r6   r  r^  r[   r{   Nr=   )r  r$   r^  r%   r   r4   r5   r6   )rS   r~   r   r6   r  r4   spl_autospl_ts   &&&&&   rW   _test_with_knots$_TestMakeSplrepBase._test_with_knots2  s    EFrJqqt||DAAaF

EGG%8

EGG%8zzUWW$$$rn   r6   c                P    V P                  4       w  r#pV P                  W#W4       R # r  )r  r  )rS   r6   r~   r   r  s   &&   rW   test_with_knots#_TestMakeSplrepBase.test_with_knots<  s"    .."aaA)rn   c           	     T   \        WW0P                  R 7      p\        WW0P                  R 7      p\        \	        WW0P                  R 7      4      R,          p\        VP                  VP                  RR7       \        VP                  VRR7       \        VP                  VRR7       R# )r]  r[   r{   Nr=   )r%   r^  r   r  r$   r   r5   r4   )rS   r~   r   r6   rV  spl_ir4   s   &&&&   rW   _test_default_s#_TestMakeSplrepBase._test_default_sB  sp    !!\\:"11llC<<@A"EuwwU3qu-/rn   c                P    V P                  4       w  r#pV P                  W#V4       R # r  )r  r  )rS   r6   r~   r   r   s   &&   rW   test_default_s"_TestMakeSplrepBase.test_default_sK  s"    .."aQ1%rn   c           
        R pV P                   R8X  dE   \        P                  ! ^ ^\        P                  ,          ^4      p\        P                  ! V4      pM\        P
                  ! ^4      pV^,          p\        P                  ! 4       ;_uu_ 4        \        P                  ! R\        4       \        W#^WP                   R8H  R7      pRRR4       \        P                  ! 4       ;_uu_ 4        \        P                  ! R\        4       \        W#^WP                   R7      pRRR4       \        XP                  X^ ,          4       \        \        P                  VP                  ^ .VP                   ^,           ,          3,          V^,          RR7       R#   + '       g   i     L; i  + '       g   i     L; i)gKH9r   r7   r6   r  r  Nr  r  r{   )r^  rK   rh   r  r  rO   warningscatch_warningssimplefilterro  r   r%   r   r4   r   r5   r6   )rS   r  r~   r   ra   rV  s   &     rW   rp  $_TestMakeSplrepBase.test_s_too_smallP  s*    <<:%Aqw+Aq	A		"A1A$$&&!! allj.HJC ' $$&&!! aa1llCC ' 	s1v&ceeaS#%%']23AU	, '& '&s   7F04F-F*	-F=	c                \   ^
pV P                   R8X  dE   \        P                  ! ^ ^\        P                  ,          V4      p\        P                  ! V4      pM\        P
                  ! V4      pV^,          p\        W4WP                   R7      p\        W4VRV P                   R7      pVP                  P                  ^8X  g   Q hVP                  P                  ^8X  g   Q h\        W4^^V,           ,          ,           VRV P                   R7      pVP                  P                  ^8X  g   Q hR# )r  r   r]  h㈵>r  N)	r^  rK   rh   r  r  rO   r%   r5   r7  )rS   r6   rU   r~   r   rV  r  rr  s   &&      rW   
test_shape_TestMakeSplrepBase.test_shapem  s     <<:%Aqw*Aq	A		!A1A!!\\:AAt||DuuzzQww||q    A1ac7{a4Nww||q   rn   c           	     &   ^
p^ ^\         P                  ,          r2\         P                  ! W#V^,           4      p\         P                  ! V4      p\	        \
        4      ;_uu_ 4        \        WERRR7       RRR4       R#   + '       g   i     R# ; i)r  :0yE>nonsenser  N)rK   r  rh   rh  rG   rI   r%   rS   Nr  rV   r~   r   s   &     rW   test_error_on_invalid_bc_type1_TestMakeSplrepBase.test_error_on_invalid_bc_type  s]    !BEE'1KKa!e$FF1I:&&j9 '&&&s   &A??B	r^  r   c           	        \         P                  ! ^ ^\         P                  ,          ^
4      p\         P                  ! V4      p\         P                  ! ^^\	        V4      4      p\        W4WRRVR8H  R7      p\        W4VRW!R7      p\        VP                  V^ ,          4       \        \         P                  VP                  ^ .VP                  ^,           ,          3,          V^,          RR7       R# )r   r  r   r:  r6   r  r  r:  r  r6   r^  r{   N)rK   rh   r  r  ra  r   r%   r   r4   r   r5   r6   )rS   r^  r6   r~   r   r:  ra   rV  s   &&&     rW   %test_make_splrep_with_unequal_weights9_TestMakeSplrepBase.test_make_splrep_with_unequal_weights  s     KK1RUU7B'FF1IKK1c!f%QQt'Z2GI!!tqBs1v&ceeaS#%%']23AT	+rn   c           	        R  p\         P                  ! ^ ^\         P                  ,          ^
4      p\         P                  ! V4      p\         P                  W43,          P
                  w  rVVP                  P                  RJ g   Q hVP                  P                  RJ g   Q h\         P                  ! ^^\        V4      4      p\         P                  Ww3,          P
                  w  rVP                  P                  RJ g   Q h\        W4V^RVR8H  R7      p
\        WTVR^VR7      pV! W4       \        W6VR^VR7      pV! W4       \        W4VR^VR7      pV! W4       \        WVVR^VR7      pV! W4       R# )c                     \        V P                  V^ ,          4       \        \        P                  V P                  ^ .V P
                  ^,           ,          3,          V^,          RR7       R# )r   r  r{   N)r   r4   rK   r   r5   r6   )rV  ra   s   &&rW   checkO_TestMakeSplrepBase.test_make_splrep_with_non_c_contiguous_input.<locals>.check  sG    CEE3q6*BEE#%%!ceeAg"67F/rn   Fr  r   r  r  N)rK   rh   r  r  r?  r'  r  r  ra  r   r%   )rS   r^  r  r~   r   r   r  r:  w1r   ra   rV  s   &&          rW   ,test_make_splrep_with_non_c_contiguous_input@_TestMakeSplrepBase.test_make_splrep_with_non_c_contiguous_input  sB   	/ KK1RUU7B'FF1Iqt xx$$---xx$$---KK1c!f%ad xx$$---QQ!t'Z2GI "17Cc !17Cc !"7Cc "B$!")+crn   c                $   \         P                  ! ^ ^^
4      p\         P                  ! ^\         P                  ,          V,          4      pV^ ,          VR,          re^pRp\         P                  ! V.V^,           ,          V.V^,           ,          ,           4      p\        W4WVVWxRVR7	      p	\        V	\        4      '       g   Q hV	P                  P                  ^ ,          ^V^,           ,          8X  g   Q hV	P                  V8X  g   Q h\        V	P                  RV^,            \         P                  ! V.V^,           ,          4      4       \        V	P                  V^,           ) R \         P                  ! V.V^,           ,          4      4       R# )r   r  N)xbxer6   r  r4   rR  r^  r=   )rK   rh   r  r  rs  r%   r5  r   r4   r   r6   r   rQ   )
rS   r^  r6   r~   r   r  r  r  r4   rV  s
   &&&       rW   %test_make_splrep_impl_no_optimization9_TestMakeSplrepBase.test_make_splrep_impl_no_optimization  s*    KK1b!FF1ruu9q=!1quB HHbTQU^rda!en45 !2tW> #w''''uu{{1~a!e,,,uuzzdqsRZZA%?@!fg

B41q5>(BCrn   rU   r  c           
        \         P                  P                  ^{4      p\         P                  ^ \         P                  ! VP                  ^ ^\         P                  ,          V^,
          R7      4      ^\         P                  ,          3,          p\         P                  ! V4      \         P                  ! V4      ,           p\        WEW P                  R8H  R7      w  rgp\        WEW P                  R7      p	V^8X  d   V^8X  d   V P                  R8X  g>   \        V	P                  VRR7       \        V	P                  VRV) ^,
           RR7       R# R# )r4  r   r   r  r  r  r[   r{   N)rK   rR   r  r   r   r  r  r  r  r   r^  r%   r   r4   r5   
rS   rU   r  r   r~   r   r4   r5   r6   rV  s
   &&&       rW   (test_make_splrep_matches_splrep_periodic<_TestMakeSplrepBase.test_make_splrep_matches_splrep_periodic  s     ii##C(EE!RWWS[[AIAE[BCQYNOFF1Iq	!)CEa!!\\:RAFt||z'ACEE151CEE1Wqb1f:E: (Brn   c           
     8   \         P                  P                  ^{4      p\         P                  ^ \         P                  ! VP                  ^ ^\         P                  ,          V^,
          R7      4      ^\         P                  ,          3,          p\         P                  ! V4      \         P                  ! V4      ,           p\        WEW P                  R8H  R7      w  rgp\        WEW P                  VR7      p	\        V	P                  VRV) ^,
           RR7       R# )r4  r   r   r  )r  r^  r4   Nr[   r{   )rK   rR   r  r   r   r  r  r  r  r   r^  r%   r   r5   r  s
   &&&       rW   "test_make_splrep_with_splrep_knots6_TestMakeSplrepBase.test_make_splrep_with_splrep_knots  s     ii##C(EE!RWWS[[AIAE[BCQYNOFF1Iq	!)CEa!!\\Q?q1"q&z6rn   r>  r0   r?   rA   rB   r   r   rs  r   )r   3   rV  rw  )r  rK  r   r0   rw  )r?  r@  rA  rB  r^  rK   r  r  r  rb   r  r  r  r  r  thread_unsaferp  r  r  r  r  r  r  r  rC  r  r  s   @rW   r  r    s    G 5Qn% [[S"45* 6*
0 [[S"45& 6& [[, ,8 [[S),! -!(: [[YT(:;[[S/2+ 3 <+ [[YT(:;+ <+\ [[YT(:;[[S/2D 3 <D, [[S"34[[S"56
; 7 5
; [[S"34[[S"567 7 57rn   r  c                      a  ] tR tRt o ]P
                  P                  R. RO4      R 4       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R tRtV tR# )TestMakeSplrepi  r6   c                B   ^ RI Hp V P                  4       w  r4p\        P                  ! ^ .V^,           ,          RR.,           ^.V^,           ,          ,           4      pV! W4R,          WaV4      p\        W4WaV4      pR F  p	\        V! V	4      V! V	4      RR7       K  	  R# )	r   Fr:   rF   Nr[   r{   r  r0   r  r   ) scipy.interpolate._fitpack_repror  r  rK   rs  r  r   )
rS   r6   r  r~   r   r  r4   ff_dr1  s
   &&        rW   test_fitpack_FTestMakeSplrep.test_fitpack_F   s     	7.."aHHaS!A#Y#s+qc1Q3i78a7Q1%aA!$AAaD#a&u5 rn   c           	        ^ RI Hp V P                  4       w  r4p\        P                  ! ^ .V^,           ,          RR.,           ^.V^,           ,          ,           4      p\        P
                  ! VP                  ^ ,          \        R7      pV! W4R	,          WaWWR7      p\        W4WaWWR7      p	\        W4WaV4      p
R
 FJ  p\        V! V4      V	! V4      RR7       \        P                  ! V
! V4      V	! V4      RR7      '       g   KJ  Q h	  R# )r   r  r:   rF   r;   Nrd  r[   r{   r  r  )r  r  r  rK   rs  rO   r   r]  r  r   r   )rS   r6   r  r~   r   r  r4   r:  fwfw_dr  r1  s   &&          rW   test_fitpack_F_with_weights*TestMakeSplrep.test_fitpack_F_with_weights  s     	7.."aHHaS!A#Y#s+qc1Q3i78IIaggaj.qG*aA+qQ1*aA!$ABqE477{{3q647???? rn   c                   ^ RI Hu Hp \        P                  P                  R4      p\        P                  ^ ^ ^ ^ \        P                  ! VP                  ^R7      4      ^,          ^^^^3	,          p\        V4      ^rT\        VP                  W54      !  P                  4       p\        W54      pVP                  ^ ,          V^V,          ,
          ^,
          8X  g   Q h\        WgRR7       R# )r   Nr  r   r[   r{   )r  interpolater8  rK   rR   r  r   r   r  ra  rw  r  r  r  r   r   )rS   r:  r   r4   rU   r6   DD_denses   &       rW   test_disc_matrixTestMakeSplrep.test_disc_matrix  s     	76ii##E*EE!Q1bggckkqk&9:1<aAqHI1vq1#((1.)113Q"wwqzQ1Wq[(((/rn   c                   ^pV P                  V4      w  r4pVP                  ^ .V^,           ,          RR.,           ^.V^,           ,          ,           4      p\        W4W%R7      w  rxpVP                  V4      VP                  V4      r\        Wv8H  4      '       g   Q h\	        W4W%R7      p	\        VRV	P                  P                  ^ ,           V	P                  RR7       R# )rA   r:   rF   rD  Nr[   r{   )r  rQ   r   r   r%   r   r5   r   )
rS   rT   r6   r~   r   r  r
  r4   r5   rV  s
   &&        rW   test_simple_vs_splrep$TestMakeSplrep.test_simple_vs_splrep+  s    ..$aZZQqS	S#J.!ac:;(azz!}bjjm117|||!!)/355;;q>*CEE>rn   c           	     b   ^pV P                  4       w  r#p\        \        W#WR7      4      R,          p\        W#WR7      p\        W#WQVR7      p\	        VP
                  VP
                  RR7       \	        VP                  VP                  RR7       VP                  VP                  8X  g   Q hR# )rA   rD  )r4   r6   r  r[   r{   Nr=   )r  r  r$   r%   r   r4   r5   r6   )rS   r6   r~   r   r  r4   r  r  s   &       rW   r  TestMakeSplrep.test_with_knots8  s    .."a/04qq.AAa0

EGG%8

EGG%8zzUWW$$$rn   c                    ^
pVP                  W!P                  R7      pV^,          p^p\        W4V^R7      pVP                  P                  ^ ,          ^V^,           ,          8X  g   Q hR# r  r;   rD  N)rO   rP   r%   r4   r   )rS   rT   rU   r~   r   r6   rV  s   &&     rW   test_no_internal_knots%TestMakeSplrep.test_no_internal_knotsE  sY    IIazzI*qD!!q)uu{{1~AaC(((rn   c                    ^
pVP                  W!P                  R7      pV^,          p\        W4^R7      p\        W4^R7      p\	        VP
                  VP
                  RR7       R# )r  r;   rz  r[   r{   N)rO   rP   r%   r   r   r5   )rS   rT   rU   r~   r   rV  r  s   &&     rW   r  TestMakeSplrep.test_default_sN  sP    IIazzI*qD!!$"11-uwwU3rn   c           	        ^p\         P                  ! V4      pV^,          p\        P                  ! \        4      ;_uu_ 4       p\        W#^RR7      p\        W#^RR7      p\        VP                  V^ ,          4       \        \         P                  VP                  ^ .VP                  ^,           ,          3,          V^,          RR7       RRR4       \        X4      ^8X  g   Q hR#   + '       g   i     L$; i)rl  rm  rD  r  r{   N)rK   rO   rb   rn  ro  r   r%   r   r4   r   r   r5   r6   ra  )rS   rU   r~   r   r  ra   rV  s   &      rW   rp  TestMakeSplrep.test_s_too_smallW  s    IIaLqD\\.))Qe,Caa51CCEE3q6*BEE#%%!ceeAg"67F0	 * 1v{{ *)s   B	C))C9	c           
        \         P                  ! . RO\         P                  R7      p\         P                  ! . RO\         P                  R7      p\         P                  ! R.VP                  ^ ,          ,          \         P                  R7      p\	        \
        4      ;_uu_ 4        \        WV^^R7       RRR4       R#   + '       g   i     R# ; i)      4@r;   g5{2?)r:  r6   r  N)r  gR9c@g
ףp=e@gףp=
Oi@gQm@gQo@g)\(p@gfffffq@gq=
ףq@g(\Yr@g)\r@g(\r@gQs@gQ3s@g33333Gs@皙as@r  g     hs@)g     J@g     H@gLH@gffffffG@gE@g)\(D@gC@g      B@g333333@@g<@g3333339@g5@g      2@g,@g%@g@g@rC   )rK   rQ   rP   r   rG   rI   r%   r  s   &   rW   test_issue_22704TestMakeSplrep.test_issue_22704e  s    JJ % -/JJ8 JJ  &(ZZ1 JJy1771:-RZZ@:&&Q"- '&&&s   'CC	c                   ^
^r2VP                  W!P                  R7      pV^,          p\        WEVR7      p\        WEVRR7      pVP                  P                  ^8X  g   Q hVP                  P                  ^8X  g   Q h\        WE^^V,           ,          ,           VRR7      pVP                  P                  ^8X  g   Q hR# )r  r;   rz  r  rD  N)rO   rP   r%   r5   r7  )	rS   rT   rU   r6   r~   r   rV  r  rr  s	   &&       rW   r  TestMakeSplrep.test_shapes  s    11IIazzI*qD!!$AA.uuzzQww||q    A1ac7{a48ww||q   rn   c                   ^
^r2VP                  W!P                  R7      pV^,          p\        WE^^ R7      p\        WE^^R7      pVP                  P                  ^8X  g   Q hVP                  P                  ^8X  g   Q hVP
                  P                  ^ ,          W#,           ^,           8X  g   Q hVP
                  P                  ^ ,          ^V^,           ,          8X  g   Q hR# r  )rO   rP   r%   r5   r7  r4   r   )rS   rT   rU   r6   r~   r   r  r  s   &&      rW   test_s0_vs_notTestMakeSplrep.test_s0_vs_not  s    11IIazzI*qDAA+AA+ww||q   ww||q   ww}}Q1519,,,ww}}Q1A;...rn   r>  Nr  )r?  r@  rA  rB  rb   r  r  r  r  r  r  r  r  r  rp  r  r  r  rC  r  r  s   @rW   r  r    s      [[S"45	6 6	6 [[S"45@ 6@ 0?%)4.! / /rn   r  c                     a  ] tR tRt o Rt]P                  P                  R. RO4      R 4       t]P                  P                  R. RO4      R 4       t	R t
R t]P                  P                  R^ R	.4      R
 4       t]P                  P                  R. RO4      ]P                  P                  RR.4      R 4       4       tRtV tR# )TestMakeSplrepPeriodici  r   r6   c                    VP                  ^ ^
^4      pVP                  R4      p\        W4V^V P                  R7      pVP                  P
                  ^ ,          ^V^,           ,          8X  g   Q hR# )r   r  Nrx  )rh   r  r%   r^  r4   r   )rS   r6   rT   r~   r   rV  s   &&&   rW   r  -TestMakeSplrepPeriodic.test_no_internal_knots  sY     KK2r"GGEN!!q$,,?uu{{1~AaC(((rn   c                   ^
p\         P                  ! ^ ^\         P                  ,          V4      p\         P                  ! V4      \         P                  ! V4      ,           p\        W4V^ V P                  R7      p\        W4V^V P                  R7      pVP                  P                  ^8X  g   Q hVP                  P                  ^8X  g   Q hVP                  P                  ^ ,          V^V,          ,           8X  g   Q hR# )r  r  N)rK   rh   r  r  r  r%   r^  r5   r7  r4   r   )rS   r6   rU   r~   r   r  r  s   &&     rW   r  %TestMakeSplrepPeriodic.test_s0_vs_not  s     KK1RUU7A&FF1Iq	!AADLLAAADLLAww||q   ww||q   ww}}Q1q1u9,,,rn   c                v   ^
p^ ^VP                   ,          rCVP                  W4V^,           VP                  R7      pVP                  V4      p\	        WVRV P
                  R7      p\        \        WW4      VRRR7       VP                  V4      VP                  V4      ,           p\	        WVRV P
                  R7      p\        \        WW4      VRRR7       ^VP                  V4      ,          VP                  V4      ^,          ,           p\	        WVRV P
                  R7      p\        \        WW4      VRRR7       R	# )
r  r;   r  r  r  r  r\   r   r  N)	r  rh   rP   r  r%   r^  r   r   r  )rS   rT   r  r  rV   r~   r   rV  s   &&      rW    test_periodic_with_periodic_data7TestMakeSplrepPeriodic.test_periodic_with_periodic_data  s    !BEE'1KKa!e2::K6FF1I!$=aqt$?FF1Iq	!!%>aqt$?bffQiK"&&)A+%!$=aqt$?rn   c           	     :   ^
p^ ^\         P                  ,          r2\         P                  ! W#V^,           4      p\         P                  ! V4      p\	        \
        4      ;_uu_ 4        \        WERV P                  R7       RRR4       R#   + '       g   i     R# ; i)r  r  r  N)rK   r  rh   rh  rG   rI   r%   r^  r  s   &     rW   $test_periodic_with_non_periodic_data;TestMakeSplrepPeriodic.test_periodic_with_non_periodic_data  sa    !BEE'1KKa!e$FF1I:&&dll; '&&&s   &B		B	r  rm  c           	        \         P                  ! R R.4      p\         P                  ! RR.4      pV^ 8  d   \         P                  ! RR.4      MRp\        W#V^RVR7      p\        W#V^^VR7      pV^ 8  d   \	        VP
                  V^ ,          4       \	        \         P                  VP                  ^ .VP                  ^,           ,          3,          V^,          4       R# )rC   r2   r  Nr   )r:  r6   r^  r  )r:  r6   r  r  )	rK   rs  r%   r   r   r4   r   r5   r6   )rS   r  r~   r   r:  rV  ra   s   &&     rW   'test_make_splrep_periodic_m_eq_2_k_eq_1>TestMakeSplrepPeriodic.test_make_splrep_periodic_m_eq_2_k_eq_1  s     HHc3Z HHc3Z $%EBHHc3Z t !!q*BQQ!a0q5CEE3q6*ceeaS#%%']23A	 rn   k_fpr  c           
        ^
p\         P                  ! ^ ^V4      p\         P                  ! ^\         P                  ,          V,          4      pVw  rg\	        WEWb^R7      pRp	\        WER
,          V^ ,          WbR7      p
\        P                  ! 4       ;_uu_ 4        \        P                  ! R\        4       \        V
R^ W,
          3\         P                  Wr,
          33VR,          4      pRRR4       V
P                  p\         P                  ! RR	.4      pV! V4      p\        V^ ,          V^,          4       R#   + '       g   i     LX; i)r  r  r  NrD  r7   rD   MbP?rC   r2   r  )rK   rh   r  r  r   r"   r  r  r  ro  r#   rN   rV  rs  r   )rS   r  r  rU   r~   r   r6   r  ra   fp0spliner   bsx_checky_checks   &&&            rW   test_fperiodic_basic_fit/TestMakeSplrepPeriodic.test_fperiodic_basic_fit  s     KK1a FF1ruu9q=!QQ+1j#a&A;$$&&!!(N;&#CGrvvrv6F'GUSA '
 ZZ((C:&W+
GAJ/ '&s   AD;;E	r>  Nr  ))r0   -C6)r?   r  )rA   gAȘ)r?  r@  rA  rB  r^  rb   r  r  r  r  r
  r  r  r  rC  r  r  s   @rW   r  r    s      G[[S"45) 6) [[S"45- 6-@"< [[S1e*-  .  [[V%QR[[S4&)0 * S0rn   r  c                      a  ] tR tRt o ^
^]3R lt]P                  P                  R. RO4      R 4       t	]P                  P                  R. RO4      R 4       t
R tR tR tR	tV tR
# )TestMakeSplprepi  c                    VP                  WP                  R 7      VP                  ,          V,          pVP                  V4      VP	                  V4      .pWEV3# )r;   )rO   rP   r  r  r  )rS   r  r6   rT   r~   r   s   &&&&  rW   _get_xykTestMakeSplprep._get_xyk  sG    IIazzI*RUU2Q6VVAYq	"Qwrn   r  c           
     P   ^
^r2\         P                  ! V4      \         P                  ,          V,          p\         P                  ! V4      \         P                  ! V4      .p^ ^R^R^	R^
/p\        WQR7      w  w  rxr9\        WQR7      w  r\        WRR7       \        V
P                  VRR7       \        V4      Wa,          8X  g   Q h\         P                  ! V4      P                  p\        V
P                  VRR7       \        V
! V4      \        WxV^R7      ! V4      RR7       R# )	r  r  r  r  r  r[   r{   r  N)rK   rO   r  r  r  r   r&   r   r4   ra  rQ   r'  r5   r   )rS   r  r  r6   r~   r   	num_knotsr4   r5   u_rV  rX  r	  s   &&           rW   test_simple_vs_splprep&TestMakeSplprep.test_simple_vs_splprep  s     11IIaL255 1$VVAYq	" CD%u=	  	qa% 	E* 	qu-1v%%% ZZ]__r. 	Aaa03%	Arn   c                   V P                  4       w  r#p\        V\        4      '       g   Q h\        P                  ! V4      ^ ,          ^8X  g   Q h\        W1R7      w  rE\        \        P                  ! V4      VR7      w  rg\        WWVR7       \        V^ ,          V^ ,          RR7       \        V^,          4      \        V^,          4      8X  g   Q h\        V^,          V^,          RR7       V^,          V^,          8X  g   Q h\        P                  ! \        WT4      4      \        P                  ! V4      8X  g   Q h\        W1R7      w  r\        WWRR7       \        VP                  V^ ,          RR7       \        VP                  P                  V^,          RR7       VP                  V^,          8X  g   Q hV! V4      P                  \        P                  ! V4      8X  g   Q h\        \        P                  ! V4      VR7      w  r\        WWRR7       \        VP                  V^ ,          RR7       \        VP                  P                  V^,          RR7       VP                  V^,          8X  g   Q hV! V4      P                  \        P                  ! V4      8X  g   Q h\        \         4      ;_uu_ 4        \        \        P                  ! V4      P                  VR7       RRR4       R#   + '       g   i     R# ; i)r   r#  r{   r[   N)r   r5  r  rK   r   r   rQ   r   ra  r   r&   r4   r5   r'  r6   rG   rI   )	rS   r  r   r   ra   rX  tck_au_arV  s	   &&       rW   test_array_not_list#TestMakeSplprep.test_array_not_list  s    --/a!T""""xx{1~""" RZZ]a0
Q'Aau53q6{c%(m+++Aau51vq!!!xxa&"((1+555a%U+uQxe4q6uua   1v||rxx{***bjjmq1U+uQxe4q6uua   1v||rxx{***:&&AA. '&&&s    ,K66L	c                    V P                  ^
VR7      w  r#p\        V4      w  rV\        V! V4      VP                  V4      RR7       R# )r  r  rT   r[   r{   Nr   r&   r   r   rS   rT   r~   r   r6   rV  rX  s   &&     rW   test_default_s_is_zero&TestMakeSplprep.test_default_s_is_zero:  s;    --"-,aaA%8rn   c                   V P                  ^
VR7      w  r#p\        V^ R7      w  rV\        VRR7      w  rx\        WhRR7       \        V! V4      VP                  V4      RR7       \        V! V4      VP                  V4      RR7       VP                  VP                  8X  g   Q hVP
                  P                  VP
                  P                  8X  g   Q hR# )r  r.  r#  r[   r{   r   N)r   r&   r   r   r  r5   r   )	rS   rT   r~   r   r6   r  u_ispl_nu_ns	   &&       rW   test_s_zero_vs_near_zero(TestMakeSplprep.test_s_zero_vs_near_zero@  s    --"-,a!!q)
!!u-
u-c
BHHQKe<c
BHHQKd;zzUZZ'''ww}}---rn   c                V   \         P                  ! ^\        R7      p\        \        4      ;_uu_ 4        \        V4       RRR4       \        \        4      ;_uu_ 4        \        V^ R7       RRR4       \        \        4      ;_uu_ 4        \        VRR7       RRR4       \        V.RR7      w  r#\        V.RR7      w  rEV! V4      P                  R8X  g   Q h\        V! V4      V.RR7       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i)	rK  r;   Nr#  r  r  r[   r{   r0   rK  )	rK   rO   r]  rG   rI   r   r&   r   r   )rS   r~   ra   r%  rV  rX  s   &     rW   r  TestMakeSplprep.test_1DM  s    IIau%:&&AJ ' :&&a  ' :&&c" ' 1#&qcT*1v||v%%%A%0 '& '& '&s#   C2DD2D	D	D(	r>  N)r   r  r  r  r?  r@  rA  rB  rK   r   rb   r  r  r&  r+  r1  r7  r  rC  r  r  s   @rW   r  r    st     qR 
 [[S"67A 8A: [[S"67/ 8/B9.1 1rn   r  c                      a  ] tR tRt o ^
^]3R lt]P                  P                  R. RO4      R 4       t	]P                  P                  R. RO4      R 4       t
R tR tR tR	tV tR
# )TestMakeSplprepPeriodici_  c                    VP                  ^ ^VP                  ,          WP                  R7      pVP                  V4      VP	                  V4      .pWEV3# )r   r;   )rh   r  rP   r  r  )rS   rU   r6   rT   r~   r   s   &&&&  rW   r    TestMakeSplprepPeriodic._get_xykb  sE    KK1RUU7AZZK8VVAYq	"Qwrn   r  c           
        ^
p\         P                  ! ^ ^\         P                  ,          V4      p\         P                  ! V4      \         P                  ! V4      .p^ ^R^R^R^/p\        WA^R7      w  w  rgr\        WARR7      w  r\        WRR7       \        V
P                  4      WQ,          8X  g   Q h\        V
! V4      \        WgV^R	7      ! V4      RRR
7       R# )r  r  r  r  r  r   r  r[   r{   r  r\   N)rK   rh   r  r  r  r   r&   r   ra  r4   r   )rS   r  rU   r~   r   r$  r4   r5   r6   r%  rV  rX  s   &&          rW   r&  .TestMakeSplprepPeriodic.test_simple_vs_splprepg  s     KK1RUU7A&VVAYq	" D"dBb9	  A.	qaj9 	E* 355zY\))) 	Aaa 8 ;"	0rn   c                &   V P                  4       w  r#p\        V\        4      '       g   Q h\        P                  ! V4      ^ ,          ^8X  g   Q h\        W1^R7      w  rE\        \        P                  ! V4      V^R7      w  rg\        WWVR7       \        V^ ,          V^ ,          RR7       \        V^,          4      \        V^,          4      8X  g   Q h\        V^,          V^,          4       F  w  r\        WRR7       K  	  V^,          V^,          8X  g   Q h\        P                  ! \        WT4      4      \        P                  ! V4      8X  g   Q h\        W1RR7      w  r\        WWRR7       V
P                  V^,          8X  g   Q hV
! V4      P                  \        P                  ! V4      8X  g   Q h\        \        P                  ! V4      VRR7      w  r\        WWRR7       V
P                  V^,          8X  g   Q hV
! V4      P                  \        P                  ! V4      8X  g   Q h\        \        4      ;_uu_ 4        \        \        P                  ! V4      P                  VRR7       RRR4       R#   + '       g   i     R# ; i)r   r  r{   r[   r   r  N)r   r5  r  rK   r   r   rQ   r   ra  ry  r   r&   r6   rG   rI   r'  )rS   r  r   r   ra   rX  r)  r*  r  r	  rV  s   &&         rW   r+  +TestMakeSplprepPeriodic.test_array_not_list  s    --/a!T""""xx{1~""" Q'RZZ]aQ7
Q'Aau53q6{c%(m+++#a&%(+FBB/ ,1vq!!!xxa&"((1+555aj9U+uua   1v||rxx{***bjjmq*EU+uua   1v||rxx{***:&&AAzB '&&&s   -I??J	c                    V P                  ^
VR7      w  r#p\        VRR7      w  rV\        V! V4      VP                  V4      RR7       R# )r  rU   rT   r   r  r[   r{   Nr/  r0  s   &&     rW   r1  .TestMakeSplprepPeriodic.test_default_s_is_zero  s>    --"-,aa4A%8rn   c                :   V P                  ^
VR7      w  r#p\        V^ RR7      w  rV\        VRRR7      w  rx\        WhRR7       VP                  V4      p	\        V! V4      V	RR7       \        V! V4      V	RRR	7       VP                  VP                  8X  g   Q hR
# )r  rF  r   r  r   r[   r{   r   r  r\   N)r   r&   r   r   r  )
rS   rT   r~   r   r6   r  r4  r5  r6  y_arrs
   &&        rW   r7  0TestMakeSplprepPeriodic.test_s_zero_vs_near_zero  s    --"-,a!!q*=
!!ujA
u-c
E6c
E4@zzUZZ'''rn   c                   \         P                  ! ^ ^\         P                  ,          ^4      p\         P                  ! V4      p\	        \
        4      ;_uu_ 4        \        V^R7       RRR4       \	        \
        4      ;_uu_ 4        \        V^ RR7       RRR4       \	        \
        4      ;_uu_ 4        \        VRRR7       RRR4       \        V.RRR7      w  r#V! V4      P                  R8X  g   Q h\        V! V4      V.RR7       R#   + '       g   i     L; i  + '       g   i     L; i  + '       g   i     Lw; i)	r   r  Nr   r  r  r[   r{   r:  )
rK   rh   r  r  rG   rI   r   r&   r   r   )rS   r~   rV  rX  s   &   rW   r  TestMakeSplprepPeriodic.test_1D  s    KK1RUU7A&FF1I:&&A1 ' :&&a4 ' :&&c:6 ' qcUJ?1v||v%%%A%0 '& '& '&s$   DD!6D4D	!D1	4E	r>  N)r   r  r  r  r<  r  s   @rW   r>  r>  _  su      qR 
 [[S"780 900 [[S"78C 9C<9(1 1rn   r>  c                   B   a  ] tR tRt o R tR tR	R ltR tR tRt	V t
R# )
BatchSplinei  c                   \         P                  ! W#R4      pVP                  RR V n        VP	                  RVP                  R,          4       Uu. uF  qd! W3/ VB NK  	  upV n        W0n        R# u upi )r0   Nr=   )rK   moveaxisr   _batch_shaper   _splines_axis)rS   r~   r   r  r  kwargsyis   &&&&$, rW   rz  BatchSpline.__init__  se    KK$GGCRL;<99RQS;UV;UR00;UV
 Ws   A2c                   V P                    Uu. uF
  q"! V4      NK  	  pp\        P                  ! W0P                  VP                  ,           4      pVP                  '       d#   \        P
                  ! VRV P                  4      # T# u upi r  )rR  rK   r   rQ  r   rP  rS  )rS   r~   r  r   s   &&  rW   r  BatchSpline.__call__  sd    %)]]3]6VAY]3JJq++agg5612r{{1b$**-?a? 4s   BNc                    V P                    Uu. uF  qDP                  WV4      NK  	  pp\        P                  ! WPP                  4      # u upi r  )rR  r#  rK   r   rQ  )rS   r  rV   r   r  r   s   &&&&  rW   r#  BatchSpline.integrate  s@    ?C}}M}VaK0}Mzz!..// Ns   Ac                    \         P                  ! V 4      pVP                   Uu. uF  q3P                  V4      NK  	  upVn        V# u upi r  )r9  deepcopyrR  r  rS   r   r8  r  s   &&  rW   r  BatchSpline.derivative  s>    mmD!<?LLIL&))"-LI
 J   Ac                    \         P                  ! V 4      pVP                   Uu. uF  q3P                  V4      NK  	  upVn        V# u upi r  )r9  r\  rR  r  r]  s   &&  rW   r  BatchSpline.antiderivative  s>    mmD!@CMf--b1M
 Nr_  )rS  rQ  rR  r  )r?  r@  rA  rB  rz  r  r#  r  r  rC  r  r  s   @rW   rN  rN    s$     @
0
 rn   rN  c            
         a  ] tR tRt o ]P
                  P                  R]/ 3]/ 3]RR/3]	RR/3]	RR/3.4      ]P
                  P                  R. RO4      ]P
                  P                  R	. RO4      R
 4       4       4       t
RtV tR# )	TestBatchi  zmake_spline, kwargsr  r2   r*  r+  r,  
eval_shaper  c                   \         P                  P                  R 4      p^
p^^^V3pRp\         P                  ! . VOVN5!  p	\         P                  ! VP                  V4      RV4      p
V\
        8X  dK   ^pV	^ ,          3V^,           ,          V	R,          3V^,           ,          ,           pV\        WR7      ,          pV! W3RV/VB p\        W3RVRV/VB pVP                  ! VRV/ p	\         P                  P                  V! V	4      V! V	4      4       VP                  ^4      VP                  ^4      r\         P                  P                  V! V	4      V! V	4      4       VP                  ^4      VP                  ^4      r\         P                  P                  V! V	4      V! V	4      4       \         P                  P                  VP                  ! V!  VP                  ! V!  4       R# )l   UU{ )r4   r6   r  r  r   N)r   r  r=   )rK   rR   r  rh   rP  r   rJ   rN  r  testingassert_allcloser  r  r#  )rS   make_splinerT  r  rd  r   rU   r   domainr~   r   r6   r4   r8  refs   &&&&&          rW   
test_batchTestBatch.test_batch  s    ii##$45Aq!KK###KK

5)2t4/)A11q5!QrUHA$66AdQn,F!4T4V4!HTH+HHKK1j1


""3q63q62%%a(#*<*<Q*?S


""3q63q62>>!$cnnQ&7S


""3q63q62


""3==&#93==&;QRrn   r>  N)r>  r0   r  rY  )r?  r@  rA  rB  rb   r  r  r   r   r   rk  rC  r  r  s   @rW   rc  rc    s     [[2
b	!
	$
%	.
Hi0	1
Hd+	,		 [[\+;<[[VZ0S 1 =Srn   rc  rG  r  rm  )}r  r  r  r!  r  r  r9  r  r  numpyrK   scipy._lib._array_apir   r   r   r   r   r   r	   r
   scipy._external.array_api_extra	_externalarray_api_extrar  rb   r   rG   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r!  scipy.sparse.linalgsparser  scipy.interpolate._bsplinesr   r   r   r    r!   r  r"   r#   r$   r%   r&   scipy.interpolate._fitpack_implr  _fitpack_implr$  scipy._lib._utilr'   scipy._lib._testutilsr(   scipy.interpolate._ndbspliner)   r*   r  r+   r  r,   r  r  r  r.   r  r  r  r   r   r  r|   r   r`   r  r<  r  r  r)  r  ru  r.  rw  r  r  r  r  r  r  r  rD  rv  r  r  r  r  r+  r3  r5  r  r  r  r  r  r  r>  rN  rc  r>  rn   rW   <module>r{     sK   	        
    . - *     
  ! !E E B G G / / & 9 5 2 - &;;// KK11  7t
) t
) t
)n G]+,W$ W$ -W$t6,$G>  $ b +$_) _)D %&`? `? '`?F88 !++11(Y<MN  ?#~: ~: $~:B >*Z	(nL nLb*
 ()J3 J3 *J3^
7:" :"z 9j4 j4 j4ZWG WGta  a L(. >"l l #l^2, ,^Q7 Q7h ;R/( R/  R/j ;\00 \0  \0~ < h1 h1 !h1V < b1 b1 !b1J 8$S $Srn   