+
    /iE                        ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^RI	H
t
 ^ RIHu Ht ^ RIHt ^ RIHtHt ^RIHtHt R.tR	 t]! R
RR.R7       ! R R4      4       tR t]P6                  3R ltRR]P6                  /R lltR# )    N)prod)GenericAlias)_dierckx)	csr_array)array_namespacexp_capabilities)_not_a_knotBSpline	NdBSplinec                    \         P                  ! V \         P                  4      '       d   \         P                  # \         P                  # )z>Return np.complex128 for complex dtypes, np.float64 otherwise.)np
issubdtypecomplexfloating
complex128float64dtypes   &Z/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/interpolate/_ndbspline.py
_get_dtyper      s-    	}}UB..//}}zz    TF)cpu_onlyjax_jitskip_backendsc                      a  ] tR t^t o Rt]! ]4      tRR/R lt]	R 4       t
]	R 4       t]	R 4       tRRRR/R	 lt]RR
 l4       tRR ltR tRtV tR# )r   a  Tensor product spline object.

The value at point ``xp = (x1, x2, ..., xN)`` is evaluated as a linear
combination of products of one-dimensional b-splines in each of the ``N``
dimensions::

   c[i1, i2, ..., iN] * B(x1; i1, t1) * B(x2; i2, t2) * ... * B(xN; iN, tN)


Here ``B(x; i, t)`` is the ``i``-th b-spline defined by the knot vector
``t`` evaluated at ``x``.

Parameters
----------
t : tuple of 1D ndarrays
    knot vectors in directions 1, 2, ... N,
    ``len(t[i]) == n[i] + k + 1``
c : ndarray, shape (n1, n2, ..., nN, ...)
    b-spline coefficients
k : int or length-d tuple of integers
    spline degrees.
    A single integer is interpreted as having this degree for
    all dimensions.
extrapolate : bool, optional
    Whether to extrapolate out-of-bounds inputs, or return `nan`.
    Default is to extrapolate.

Attributes
----------
t : tuple of ndarrays
    Knots vectors.
c : ndarray
    Coefficients of the tensor-product spline.
k : tuple of integers
    Degrees for each dimension.
extrapolate : bool, optional
    Whether to extrapolate or return nans for out-of-bounds inputs.
    Defaults to true.

Methods
-------
__call__
derivative
design_matrix

See Also
--------
BSpline : a one-dimensional B-spline object
NdPPoly : an N-dimensional piecewise tensor product polynomial

extrapolateNc               z   \        W14      w  V n        V n        w  V n        V n        \        V.VO5!  P                  V n        Vf   Rp\        V4      V n	        \        P                  ! V4      V n        V P                  P                  ^ ,          pV P                  P                  V8  d   \        RV R24      h\        V4       F  pV P                   V,          pV P"                  V,          pVP                  ^ ,          V,
          ^,
          p	V P                  P                  V,          V	8w  g   Kn  \        RV RV P                  P                  V,           R\%        V4       RV	 RV R	24      h	  \'        V P                  P(                  4      p
\        P*                  ! V P                  V
R
7      V n        R # )NTzCoefficients must be at least z-dimensional.z,Knots, coefficients and degree in dimension z are inconsistent: got z coefficients for z knots, need at least z for k=.r   )_preprocess_inputs_k_indices_k1d_t_len_tr   asarray_asarrayboolr   r   _cshapendim
ValueErrorrangetklenr   r   ascontiguousarray)selfr+   cr,   r   r(   dtdkdndts   &&&&$      r   __init__NdBSpline.__init__[   sm   =OPQ=U:"$:TWdk'.A.66K,**Q-ww}}Q77<<$=dV=QRRtABBb 1$Aww}}Q1$  $%%&C ())-q)9(: ;%%(WI-CA3 G''(c	", - -  &&&twwb9r   c                ,    \        V P                  4      # N)tupler   r/   s   &r   r,   NdBSpline.ky   s    TWW~r   c                   a  \         ;QJ d;    . V 3R  l\        S P                  P                  ^ ,          4       4       F  NK  	  5# ! V 3R  l\        S P                  P                  ^ ,          4       4       4      # )c              3      <"   T F<  pSP                  SP                  VR SP                  V,          13,          4      x  K>  	  R # 5ir9   )r$   r!   r"   ).0r1   r/   s   & r   	<genexpr>NdBSpline.t.<locals>.<genexpr>   s;      
@W1DMM$''!_dkk!n_"4566@Ws   AA)r:   r*   r!   r'   r;   s   fr   r+   NdBSpline.t}   s]     u 
@EdggmmTUFV@W
u 	
u 
@EdggmmTUFV@W
 
 	
r   c                8    V P                  V P                  4      # r9   )r$   r&   r;   s   &r   r0   NdBSpline.c   s    }}TWW%%r   nuc                  V P                   P                  ^ ,          pVf   V P                  p\        V4      pVf)   \        P
                  ! V3\        P                  R7      pM\        P                  ! V\        P                  R7      pVP                  ^8w  g   VP                  ^ ,          V8w  d'   \        RV: R\        V P                  4       R24      h\        V^ 8  4      '       d   \        RV: 24      h\        P                  ! V\        R7      pVP                  pVP                  R
VR
,          4      p\        P                  ! V4      pVR
,          V8w  d   \        RV RV 24      hV P                   P"                  P$                  R	8H  pV P                   pV'       d/   V P                   P                  V8X  d   V P                   R,          pVP'                  \        4      pVP                  VP                  RV R,           4      pVP)                  4       p	\        P                  ! VP*                   U
u. uF  p
WP"                  P,                  ,          NK!  	  up
\        P                  R7      pVP                  R
,          p\.        P0                  ! VV P                   V P2                  V P4                  VVV	VVV P6                  4
      pVP'                  V P                   P"                  4      pVP                  VRR
 V P                   P                  VR ,           4      pV P9                  V4      # u up
i )a  Evaluate the tensor product b-spline at ``xi``.

Parameters
----------
xi : array_like, shape(..., ndim)
    The coordinates to evaluate the interpolator at.
    This can be a list or tuple of ndim-dimensional points
    or an array with the shape (num_points, ndim).
nu : sequence of length ``ndim``, optional
    Orders of derivatives to evaluate. Each must be non-negative.
    Defaults to the zeroth derivivative.
extrapolate : bool, optional
    Whether to exrapolate based on first and last intervals in each
    dimension, or return `nan`. Default is to ``self.extrapolate``.

Returns
-------
values : ndarray, shape ``xi.shape[:-1] + self.c.shape[ndim:]``
    Interpolated values at ``xi``
Nr   )invalid number of derivative orders nu =  for ndim = r   z'derivatives must be positive, got nu = zShapes: xi.shape=z
 and ndim=r0   ).N)rI   )r!   r'   r   r%   r   zerosint64r#   r(   r)   r-   r+   anyfloatreshaper.   r&   r   kindviewravelstridesitemsizer   evaluate_ndbspliner"   r   r    r$   )r/   xirE   r   r(   xi_shapewas_complexccc1c1rs_strides_c1num_c_trouts   &&$$          r   __call__NdBSpline.__call__   s   * ww}}Q**K;':4'2BBbhh/Bww!|rxx{d2 @2' B!$&&k]!-. . 26{{ #KbW!MNN ZZ%(88ZZHRL)!!"%B<40
*TFKLL ggmm((C/WW477<<4/ #BWWU^ ZZ$%/0hhj jj+-::"7+5a #$xx'8'8"8"8+5"7>@hhH 88B<))"!%!%!%!#!,!$!)!,!%!2!2

 hhtww}}%kk(3B-$''--*>>?}}S!!#"7s    %L>c                r  aa \         P                  ! V\        R7      pVP                  R,          p\	        V4      V8w  d   \        R\	        V4       RV: R24      h\        SV4      w  opw  po\        ;QJ d!    . VV3R l\        V4       4       F  NK  	  5M! VV3R l\        V4       4       4      pVR,          R	,           p	\         P                  ! V	RRR1,          \         P                  R7      RRR1,          P                  4       p
\        P                  ! VVSSWj4      w  rp\        WV34      # )
a|  Construct the design matrix as a CSR format sparse array.

Parameters
----------
xvals :  ndarray, shape(npts, ndim)
    Data points. ``xvals[j, :]`` gives the ``j``-th data point as an
    ``ndim``-dimensional array.
t : tuple of 1D ndarrays, length-ndim
    Knot vectors in directions 1, 2, ... ndim,
k : int
    B-spline degree.
extrapolate : bool, optional
    Whether to extrapolate out-of-bounds values of raise a `ValueError`

Returns
-------
design_matrix : a CSR array
    Each row of the design matrix corresponds to a value in `xvals` and
    contains values of b-spline basis elements which are non-zero
    at this value.

r   z*Data and knots are inconsistent: len(t) = z for  ndim = r   c              3   `   <"   T F#  pSV,          SV,          ,
          ^,
          x  K%  	  R# 5i   N )r?   r1   r,   len_ts   & r   r@   *NdBSpline.design_matrix.<locals>.<genexpr>   s%     A[a1Q4!++[s   +.rd   NNNrI   rd   )r   r#   rM   r'   r-   r)   r   r:   r*   cumprodrK   copyr   	_coloc_ndr   )clsxvalsr+   r,   r   r(   r    r!   c_shapecscstridesdataindicesindptrrf   s   &&&f&         @r   design_matrixNdBSpline.design_matrix   s
   0 

5.{{2q6T><SVH E9A  (:!Q'?$<"e
 %AU4[A%%AU4[AA R[4::b2hbhh7"=BBD !) 2 25E1l!6v $011r   c           	     ^   \         P                  ! W^ 4      pVP                  ^ ,          pVP                  R,          pVP                  VR4      p. p	Rp
\	        VP                  ^,          4       F  pW58  dr   \
        P                  ! W(RV3,          V4      pVP                  V4      pVP                  R\        VP                  4      VP                  ,
          ^,
           Vn        M<\
        P                  ! V\         P                  ! \        V4      ^,
          4      ^ 4      pV
f   VP                  p
V	P                  VP                  4       K  	  \         P                  ! V	^R7      P                  \        V	^ ,          4      3V,           4      p\         P                  ! V^ V4      pW3# )r   rh   NNNN)axisrI   )r   moveaxisr'   rN   r*   r
   construct_fast
derivativer0   r-   r+   r,   rJ   appendstack)r/   r0   r+   r,   ry   rE   r4   trailing_shapec_flat
new_c_listnew_tibdbnew_cs   &&&&&&         r   _bspline_derivative_along_axis(NdBSpline._bspline_derivative_along_axis  sC   KK#GGAJ1b!
v||A'Aw**1QTlA>\\"%tt1SY-12++ArxxA
/CQG}bdd# ( !,44A!N24E1d+|r   c           	       a  \         P                  ! V\         P                  R7      p\        S P                  4      pVP
                  ^8w  g   VP                  ^ ,          V8w  d'   \        RV: R\        S P                  4       R24      h\        V^ 8  4      '       d   \        RV: 24      h\        S P                  P                  ^ ,          4       Uu. uF+  pS P                  VRS P                  V,          13,          NK-  	  pp\        S P                  4      pS P                  P                  4       p\!        V4       FO  w  rV	^ 8X  d   K  S P#                  WuV,          Wh,          WR7      w  quV&   \%        Wh,          V	,
          ^ 4      Wh&   KQ  	  \'        \(        ;QJ d    . V 3R lV 4       F  NK  	  5M! V 3R lV 4       4      S P+                  V4      \)        V4      S P,                  R	7      # u upi )
a+  
Construct a new NdBSpline representing the partial derivative.

Parameters
----------
nu : array_like of shape (ndim,)
    Orders of the partial derivatives to compute along each dimension.

Returns
-------
NdBSpline
    A new NdBSpline representing the partial derivative of the original spline.

r   rG   rH   r   z-derivative orders must be positive, got nu = N)rE   c              3   F   <"   T F  pSP                  V4      x  K  	  R # 5ir9   )r$   )r?   r+   r/   s   & r   r@   'NdBSpline.derivative.<locals>.<genexpr>Q  s     ?At}}Q//s   !)r   )r   r#   rK   r-   r+   r(   r'   r)   rL   r*   r!   r"   listr,   r&   rk   	enumerater   maxr   r:   r$   r   )
r/   rE   nu_arrr(   r1   t_newk_newc_newry   r4   s
   f&        r   r|   NdBSpline.derivative)  s    Bbhh/466{;;!v||A$6<rg >dff+a)* * vz??MwOPP 7<DGGMM!<L6MN6MOT[[^O+,,6MNTVV (GDAv!%!D!DT{EK "E "E; ekAoq1EK ) ?????u-u%)%5%5
 	
 Os   1G8)r$   r&   r    r   r"   r!   r   )Tri   )__name__
__module____qualname____firstlineno____doc__classmethodr   __class_getitem__r6   propertyr,   r+   r0   r_   ru   r   r|   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s     2j $L1:t :<   
 
 & &N" N"4 N"` 02 02d<,
 ,
r   c           
        \        V\        4      '       g   \        RV R24      h\        V4      p \        V 4       \
        P                  ! V  Uu. uF  p\        P                  ! V4      NK  	  up\
        P                  R7      p \        V 4      V8w  d&   \        R\        V4       R\        V 4      : R24      h\        V4      p\        V4       EF`  p\
        P                  ! W,          4      pW,          pVP                  ^ ,          V,
          ^,
          pV^ 8  d   \        RV R24      hVP                  ^8w  d   \        R	V R
24      hWv^,           8  d$   \        R^V,          ^,            RV RV R24      h\
        P                  ! V4      ^ 8  P                  4       '       d   \        RV R24      h\        \
        P                  ! WVV^,            4      4      ^8  d   \        RV R24      h\
        P                   ! V4      P#                  4       '       d   EKT  \        RV R24      h	  \        ;QJ d    . R V  4       F  NK  	  5M! R V  4       4      p\
        P$                  ! \
        P&                  ! \)        V4      4      V4      p	\
        P                  ! V	\
        P                  R7      P*                  P-                  4       p
V Uu. uF  p\
        P                  ! V4      NK  	  pp\        V4      pV Uu. uF  p\        V4      NK  	  pp\
        P.                  ! V\1        V4      3\2        R7      pVP5                  \
        P6                  4       \        V4       F   pW,          WR\        W,          4      13&   K"  	  \
        P                  ! V\
        P                  R7      pW
W33#   \         d    T 3T,          p  ELi ; iu upi u upi u upi )zHelpers: validate and preprocess NdBSpline inputs.

Parameters
----------
k : int or tuple
   Spline orders
t_tpl : tuple or array-likes
   Knots.
z-Expect `t` to be a tuple of array-likes. Got z	 instead.r   z	len(t) = z != len(k) = r   zSpline degree in dimension z cannot be negative.zKnot vector in dimension z must be one-dimensional.zNeed at least z knots for degree z in dimension zKnots in dimension z# must be in a non-decreasing order.z.Need at least two internal knots in dimension z should not have nans or infs.c              3   2   "   T F  q^,           x  K  	  R# 5irc   re   )r?   r3   s   & r   r@   %_preprocess_inputs.<locals>.<genexpr>  s     %1Rq&&1s   N)
isinstancer:   r)   r-   	TypeErrorr   r#   operatorindexrK   r*   r'   r(   diffrL   uniqueisfiniteallunravel_indexaranger   Trk   emptyr   rM   fillnan)r,   t_tplr(   kir1   r2   r3   r4   r'   rs   r    r+   tirf   r!   s   &&             r   r   r   W  sV    eU##   %wi1 
 	

 u:DA
 	

32HNN2&3288DA
1v~9SZLSVKqABB u:D4[ZZ!THHQK"q 6:1# >* + , ,77a<8 <1 2 3 3Av:~adQhZ 8!!#N1#Q8 9 9GGBK!O  ""21# 66 7 8 8ryyq1u&'!+  ++,#Q0 1 1{{2""$$21# 6. / 0 0) 2 E%1%EE%1%%Eryye5u=G::gRXX688==?L %**EqRZZ]EE*u:D$%uSWuE%	4U$E	2BGGBFFO4[ %ns58}n JJuBHH-ERK''m  DI 4R +%s#   N? OO 	O%?OOc           
      p   \         P                  ! VP                  \         P                  4      '       d?   \	        WP
                  V3/ VB p\	        WP                  V3/ VB pVR V,          ,           # VP                  ^8X  d   VP                  ^,          ^8w  dt   \         P                  ! V4      p\        VP                  ^,          4       F;  pV! WRV3,          3/ VB w  VRV3&   pV^ 8w  g   K&  \        RV: RV: RV R24      h	  V# V! W3/ VB w  rhV^ 8w  d   \        RV: RV: R24      hV# )y              ?rx   z	solver = z returns info =z for column r   z returns info = )r   r   r   r   _iter_solverealimagr(   r'   
empty_liker*   r)   )	ar   solversolver_argsr   r   resjinfos	   &&&,     r   r   r     s   
 
}}QWWb00111fff<<1fff<<bg~vv{qwwqzA~mmAqwwqz"A$Q!Q$?;?OC1Itqy IF;.>x|A3a!PQQ # 
1/;/	19	{*;D9A>??
r   r   c               d  a a \        S 4      p\        ;QJ d    . R S  4       F  NK  	  5M! R S  4       4      p \        S4       \        S 4       F_  w  rx\        \        P
                  ! V4      4      p	V	SV,          8:  g   K4  \        RV	 RV RSV,           RSV,          ^,            R2	4      h	  \        ;QJ d!    . VV 3R l\        V4       4       F  NK  	  5M! VV 3R l\        V4       4       4      p
\        P                  ! \        P                  ! S !   Uu. uF  qNK  	  up\        R7      p\        P                  WS4      pS^ ,          ^8  d   VP                  4        VP                  p\!        VR	V 4      \!        WR	 4      3pVP#                  V4      pV\$        P&                  8w  d)   \(        P*                  ! \,        VR
7      pRV9  d   RVR&   V! VV3/ VB pVP#                  WnVR	 ,           4      p\        V
VS4      #   \         d    S3T,          o ELi ; iu upi )a+  Construct an interpolating NdBspline.

Parameters
----------
points : tuple of ndarrays of float, with shapes (m1,), ... (mN,)
    The points defining the regular grid in N dimensions. The points in
    each dimension (i.e. every element of the `points` tuple) must be
    strictly ascending or descending.
values : ndarray of float, shape (m1, ..., mN, ...)
    The data on the regular grid in n dimensions.
k : int, optional
    The spline degree. Must be odd. Default is cubic, k=3
solver : a `scipy.sparse.linalg` solver (iterative or direct), optional.
    An iterative solver from `scipy.sparse.linalg` or a direct one,
    `sparse.sparse.linalg.spsolve`.
    Used to solve the sparse linear system
    ``design_matrix @ coefficients = rhs`` for the coefficients.
    Default is `scipy.sparse.linalg.gcrotmk`
solver_args : dict, optional
    Additional arguments for the solver. The call signature is
    ``solver(csr_array, rhs_vector, **solver_args)``

Returns
-------
spl : NdBSpline object

Notes
-----
Boundary conditions are not-a-knot in all dimensions.
c              3   8   "   T F  p\        V4      x  K  	  R # 5ir9   )r-   )r?   xs   & r   r@   make_ndbspl.<locals>.<genexpr>  s     ,VSVVVs   z
There are z points in dimension z, but order z requires at least  z points per dimension.c              3      <"   T F9  p\        \        P                  ! SV,          \        R 7      SV,          4      x  K;  	  R# 5i)r   N)r	   r   r#   rM   )r?   r1   r,   pointss   & r   r@   r     s5      $"! "**VAYe<adCC"s   AAr   N)r   atolgư>)r-   r:   r   r   r   
atleast_1dr)   r*   r#   	itertoolsproductrM   r   ru   eliminate_zerosr'   r   rN   sslspsolve	functoolspartialr   )r   valuesr,   r   r   r(   rV   r1   pointnumptsr+   xvrn   matrv_shape
vals_shapevalscoefs   f&f$,             r   make_ndbsplr     s   > v;Du,V,uu,V,,HA
 f%R]]5)*QqT>z&1Fqc J++,Q4& 1!!"1a(>@ A A & 	 $T{$ $T{$ 	$AJJY%6%6%?@%?r%?@NE ""5Q/D 	tqy
 llGwu~&WU^(<=J>>*%D"";v>$"&K$,,D<<45>12DQa  M  DI As   H  
H-H*)H*)z
dask.arrayz7https://github.com/data-apis/array-api-extra/issues/488)   )r   r   r   numpyr   mathr   typesr    r   scipy.sparse.linalgsparselinalgr   scipy.sparser   scipy._lib._array_apir   r   	_bsplinesr	   r
   __all__r   r   r   gcrotmkr   r   re   r   r   <module>r      s           ! ! " B +- 5	Dr
 r
r
h	J(Z ![[ 0J!s{{ J!r   