ó
    Eñi§E  ã                   ó
  • S SK r S SKrS SKrS SKrS SKJr  S SKJr  SSK	J
r
  S SKJs  Jr  S SKJr  S SKJrJr  SSKJrJr  S	/rS
 r\" SSS/S9 " S S	5      5       rS r\R6                  4S jrS\R6                  S.S jjrg)é    N)Úprod)ÚGenericAliasé   )Ú_dierckx)Ú	csr_array)Úarray_namespaceÚxp_capabilities)Ú_not_a_knotÚBSplineÚ	NdBSplinec                 ó–   • [         R                  " U [         R                  5      (       a  [         R                  $ [         R                  $ )z>Return np.complex128 for complex dtypes, np.float64 otherwise.)ÚnpÚ
issubdtypeÚcomplexfloatingÚ
complex128Úfloat64©Údtypes    ÚY/home/mande/repo/quber/.venv/lib/python3.13/site-packages/scipy/interpolate/_ndbspline.pyÚ
_get_dtyper      s-   € ä	‡}‚}�UœB×.Ñ.×/Ñ/Ü�}‰}Ðä�z‰zÐó    TF)z
dask.arrayz7https://github.com/data-apis/array-api-extra/issues/488)Úcpu_onlyÚjax_jitÚskip_backendsc                   óš   • \ rS rSrSr\" \5      rSS.S jr\	S 5       r
\	S 5       r\	S 5       rSSS	.S
 jr\SS j5       rSS jrS rSrg)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

N©Úextrapolatec                ó*  • [        X15      u  U l        U l        u  U l        U l        [        U/UQ76 R                  U l        Uc  Sn[        U5      U l	        [        R                  " U5      U l        U R                  R                  S   nU R                  R                  U:  a  [        SU S35      e[        U5       HŽ  nU R                   U   nU R"                  U   nUR                  S   U-
  S-
  n	U R                  R                  U   U	:w  d  MU  [        SU SU R                  R                  U    S[%        U5       S	U	 S
U S35      e   ['        U R                  R(                  5      n
[        R*                  " U R                  U
S9U l        g )NTr   zCoefficients must be at least z-dimensional.r   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  € Ü=OÐPQÓ=UÑ:ˆŒ�Ô"Ñ$: T¤W¨d¬kä'¨Ð.¨AÒ.×6Ñ6ˆŒàÑØˆKÜ Ó,ˆÔä—*’*˜Q“-ˆŒà�w‰w�}‰}˜QÑˆØ�7‰7�<‰<˜$ÓÜÐ=¸d¸VÀ=ÐQÓRÐRä�t–ˆAØ—‘˜‘ˆBØ—‘˜‘ˆBØ—‘˜‘˜bÑ  1Ñ$ˆAà�w‰w�}‰}˜QÑ 1Õ$Ü ð $%Ø%& Cð ()Ø)-¯©¯©°qÑ)9Ð(:ð ;%Ü%(¨£W IÐ-CÀAÀ3ð G'Ø'( c¨ð	",ó -ð -ñ ô ˜Ÿ™Ÿ™Ó&ˆÜ×&Ò& t§w¡w°bÑ9ˆ�r   c                 ó,   • [        U R                  5      $ ©N)Útupler"   ©r2   s    r   r/   ÚNdBSpline.ky   s   € ä�T—W‘W‹~Ðr   c                 ón   ^ • [        U 4S j[        T R                  R                  S   5       5       5      $ )Nc              3   ó‚   >#   • U  H4  nTR                  TR                  US TR                  U   24   5      v •  M6     g 7fr<   )r'   r$   r%   )Ú.0r4   r2   s     €r   Ú	<genexpr>ÚNdBSpline.t.<locals>.<genexpr>€   s;   øé € ð 
Ú@W¸1ˆD�M‰M˜$Ÿ'™' ! _ d§k¡k°!¡n _Ð"4Ñ5×6Ð6Ò@Wùs   ƒ<?r   )r=   r-   r$   r*   r>   s   `r   r.   ÚNdBSpline.t}   s2   ø€ ô ô 
Ü@EÀdÇgÁgÇmÁmÐTUÑFVÔ@Wó
ó 
ð 	
r   c                 ó8   • U R                  U R                  5      $ r<   )r'   r)   r>   s    r   r3   ÚNdBSpline.c„   s   € à�}‰}˜TŸW™WÓ%Ð%r   )Únur   c                ó  • U R                   R                  S   nUc  U R                  n[        U5      nUc%  [        R
                  " U4[        R                  S9nOŽ[        R                  " U[        R                  S9nUR                  S:w  d  UR                  S   U:w  a&  [        SU< S[        U R                  5       S35      e[        US:  5      (       a  [        SU< 35      e[        R                  " U[        S9nUR                  nUR                  S	US	   5      n[        R                  " U5      nUS	   U:w  a  [        S
U SU 35      eU R                   R"                  R$                  S:H  nU R                   nU(       a)  U R                   R                  U:X  a  U R                   S   nUR'                  [        5      nUR                  UR                  SU S-   5      nUR)                  5       n	[        R                  " UR*                   V
s/ s H  n
X¨R"                  R,                  -  PM     sn
[        R                  S9nUR                  S	   n[.        R0                  " UU R                   U R2                  U R4                  UUU	UUU R6                  5
      nUR'                  U R                   R"                  5      nUR                  USS	 U R                   R                  US -   5      nU R9                  U5      $ s  sn
f )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``
r   Nr   r   ú)invalid number of derivative orders nu = ú for ndim = r    z'derivatives must be positive, got nu = éÿÿÿÿzShapes: xi.shape=z
 and ndim=r3   ).N)rL   )r$   r*   r   r(   r   ÚzerosÚint64r&   r+   r,   r0   r.   ÚanyÚfloatÚreshaper1   r)   r   ÚkindÚviewÚravelÚstridesÚitemsizer   Úevaluate_ndbspliner%   r"   r#   r'   )r2   ÚxirH   r   r+   Úxi_shapeÚwas_complexÚccÚc1Úc1rÚsÚ_strides_c1Únum_c_trÚouts                 r   Ú__call__ÚNdBSpline.__call__ˆ   s�  € ð* �w‰w�}‰}˜QÑˆàÑØ×*Ñ*ˆKÜ˜;Ó'ˆà‰:Ü—’˜4˜'¬¯©Ñ2‰Bä—’˜B¤b§h¡hÑ/ˆBØ�w‰w˜!‹|˜rŸx™x¨™{¨dÓ2Ü Ø@¸2¹'ð BÜ! $§&¡&›k˜]¨!ð-ó.ð .ô �2˜‘6�{‰{Ü Ð#KÀbÁWÐ!MÓNÐNô �ZŠZ˜¤%Ñ(ˆØ—8‘8ˆØ�Z‰Z˜˜H R™LÓ)ˆÜ×!Ò! "Ó%ˆà�B‰<˜4ÓÜÐ0°°
¸*ÀTÀFÐKÓLÐLð —g‘g—m‘m×(Ñ(¨CÑ/ˆØ�W‰WˆÞ˜4Ÿ7™7Ÿ<™<¨4Ó/ð —‘˜Ñ#ˆBØ�W‰W”U‹^ˆð �Z‰Z˜Ÿ™  $˜¨%Ñ/Ó0ˆØ�h‰h‹jˆô —j’jØ+-¯:ª:ó"7Ú+5 að #$§x¡x×'8Ñ'8Ô"8Ù+5ñ"7Ü>@¿h¹hñHˆð —8‘8˜B‘<ˆÜ×)Ò)¨"Ø!%§¡Ø!%§¡Ø!%§¡Ø!#Ø!,Ø!$Ø!)Ø!,Ø!%×!2Ñ!2ó

ˆð �h‰h�t—w‘w—}‘}Ó%ˆØ�k‰k˜( 3 B˜-¨$¯'©'¯-©-¸¸Ð*>Ñ>Ó?ˆØ�}‰}˜SÓ!Ð!ùò#"7s   È"Lc                 óî  ^^• [         R                  " U[        S9nUR                  S   n[	        U5      U:w  a  [        S[	        U5       SU< S35      e[        TU5      u  mnu  nm[        UU4S j[        U5       5       5      nUSS S	-   n	[         R                  " U	SSS2   [         R                  S9SSS2   R                  5       n
[        R                  " UUTTXj5      u  p¼n[        X¼U45      $ )
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   rL   z*Data and knots are inconsistent: len(t) = z for  ndim = r    c              3   ó@   >#   • U  H  nTU   TU   -
  S -
  v •  M     g7f©r   N© )rB   r4   r/   Úlen_ts     €€r   rC   Ú*NdBSpline.design_matrix.<locals>.<genexpr>þ   s"   øé € ÐA²[°˜˜a™ 1 Q¡4™¨!Ö+²[ùs   ƒr   N©r   )r   r&   rP   r*   r0   r,   r!   r=   r-   ÚcumprodrN   Úcopyr   Ú	_coloc_ndr   )ÚclsÚxvalsr.   r/   r   r+   r#   r$   Úc_shapeÚcsÚcstridesÚdataÚindicesÚindptrrh   s      `          @r   Údesign_matrixÚNdBSpline.design_matrixØ   sú   ù€ ô0 —
’
˜5¬Ñ.ˆØ�{‰{˜2‰ˆÜˆq‹6�T‹>ÜØ<¼SÀ»V¸Hð EØ‘9˜Aðóð ô (:¸!¸QÓ'?Ñ$ˆˆ<™˜"˜eô
 ÕA´U¸4´[ÓAÓAˆð �Q�Rˆ[˜4ÑˆÜ—:’:˜b¡ 2 ™h¬b¯h©hÑ7¹¸"¸Ñ=×BÑBÓDˆô !)× 2Ò 2°5Ø�E˜1˜ló!6Ñˆ�vô ˜$¨Ð0Ó1Ð1r   c           	      ó  • [         R                  " XS5      nUR                  S   nUR                  SS  nUR                  US5      n/ n	S n
[	        UR                  S   5       HÑ  nX5:¼  ag  [
        R                  " X(S S 2U4   U5      nUR                  U5      nUR                  S [        UR                  5      UR                  -
  S-
   Ul        O8[
        R                  " U[         R                  " [        U5      S-
  5      S5      nU
c  UR                  n
U	R                  UR                  5        MÓ     [         R                  " U	SS9R                  [        U	S   5      4U-   5      n[         R                  " USU5      nXê4$ )Nr   r   rL   )Úaxis)r   Úmoveaxisr*   rQ   r-   r   Úconstruct_fastÚ
derivativer3   r0   r.   r/   rM   ÚappendÚstack)r2   r3   r.   r/   ry   rH   r7   Útrailing_shapeÚc_flatÚ
new_c_listÚnew_tÚiÚbÚdbÚnew_cs                  r   Ú_bspline_derivative_along_axisÚ(NdBSpline._bspline_derivative_along_axis  sE  € ä�KŠK˜ Ó#ˆØ�G‰G�A‰JˆØŸ™  ˜ˆØ—‘˜1˜bÓ!ˆàˆ
Øˆä�v—|‘| A‘Ö'ˆAØ‹wÜ×*Ò*¨1²Q¸°T©l¸AÓ>�Ø—\‘\ "Ó%�à—t‘tÐ1œS §¡›Y¨¯©Ñ-°Ñ1Ð2�•ä×+Ò+¨A¬r¯xªx¼¸A»À¹
Ó/CÀQÓG�à‰}ØŸ™�à×Ñ˜bŸd™dÖ#ñ (ô —’˜¨!Ñ,×4Ñ4Ü�˜A‘ÓÐ! NÑ2ó4ˆä—’˜E 1 dÓ+ˆàˆ|Ðr   c           	      óh  ^ • [         R                  " U[         R                  S9n[        T R                  5      nUR
                  S:w  d  UR                  S   U:w  a&  [        SU< S[        T R                  5       S35      e[        US:  5      (       a  [        SU< 35      e[        T R                  R                  S   5       Vs/ s H#  nT R                  UST R                  U   24   PM%     nn[        T R                  5      nT R                  R                  5       n[!        U5       H;  u  p‰U	S:X  a  M  T R#                  XuU   Xh   X‰S	9u  ouU'   [%        Xh   U	-
  S5      Xh'   M=     ['        [)        U 4S
 jU 5       5      T R+                  U5      [)        U5      T R,                  S9$ s  snf )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   r   r   rJ   rK   r    z-derivative orders must be positive, got nu = N)rH   c              3   óF   >#   • U  H  nTR                  U5      v •  M     g 7fr<   )r'   )rB   r.   r2   s     €r   rC   Ú'NdBSpline.derivative.<locals>.<genexpr>Q  s   øé € Ð?º°A˜tŸ}™}¨Q×/Ð/ºùs   ƒ!r   )r   r&   rN   r0   r.   r+   r*   r,   rO   r-   r$   r%   Úlistr/   r)   rl   Ú	enumerater‡   Úmaxr   r=   r'   r   )
r2   rH   Únu_arrr+   r4   Út_newÚk_newÚc_newry   r7   s
   `         r   r|   ÚNdBSpline.derivative)  s‰  ø€ ô —’˜B¤b§h¡hÑ/ˆÜ�4—6‘6‹{ˆà�;‰;˜!Ó˜vŸ|™|¨A™°$Ó6ÜØ<°r±gð >Ü˜dŸf™f›+˜ að)ó*ð *ô ˆv˜‰z�?‰?ÜÐMÈÁwÐOÓPÐPô 7<¸D¿G¹G¿M¹MÈ!Ñ<LÔ6MÓNÒ6M°�—‘˜˜O˜TŸ[™[¨™^˜OÐ+Ô,Ñ6MˆÐNÜ�T—V‘V“ˆØ—‘—‘“ˆä  Ö(‰GˆDØ�A‹vÙà!%×!DÑ!DØ˜T‘{ E¡K°ð "Eð "ÑˆE˜‘;ô ˜e™k¨A™o¨qÓ1ˆE‹Kñ )ô œÔ?¹Ó?Ó?ØŸ™ uÓ-Ü˜u›Ø%)×%5Ñ%5ñ
ð 	
ùò Os   Ã	*F/)r'   r)   r#   r"   r%   r$   r   )Trj   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úclassmethodr   Ú__class_getitem__r9   Úpropertyr/   r.   r3   rb   rv   r‡   r|   Ú__static_attributes__rg   r   r   r   r      s†   † ñ2ñj $ LÓ1Ðà/3õ :ð< ñó ðð ñ
ó ð
ð ñ&ó ð&ð "&°4õ N"ð` ó02ó ð02ôdõ<,
r   c           
      ó  • [        U[        5      (       d  [        SU S35      e[        U5      n [        U 5        [
        R                  " U  Vs/ s H  n[        R                  " U5      PM     sn[
        R                  S9n [        U 5      U:w  a%  [        S[        U5       S[        U 5      < S35      e[        U5      n[        U5       GH6  n[
        R                  " X   5      nX   nUR                  S   U-
  S-
  nUS:  a  [        S	U S
35      eUR                  S:w  a  [        SU S35      eXvS-   :  a  [        SSU-  S-    SU SU S35      e[
        R                  " U5      S:  R                  5       (       a  [        SU S35      e[        [
        R                  " XVUS-    5      5      S:  a  [        SU S35      e[
        R                   " U5      R#                  5       (       a  GM*  [        SU S35      e   [        S U  5       5      n[
        R$                  " [
        R&                  " [)        U5      5      U5      n	[
        R                  " U	[
        R                  S9R*                  R-                  5       n
U Vs/ s H  n[
        R                  " U5      PM     nn[        U5      nU Vs/ s H  n[        U5      PM     nn[
        R.                  " U[1        U5      4[2        S9nUR5                  [
        R6                  5        [        U5       H  nX   XäS[        X   5      24'   M     [
        R                  " U[
        R                  S9nX
Xí44$ ! [         a
    U 4U-  n  GN?f = fs  snf s  snf s  snf )z“Helpers: 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    r   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   ó*   #   • U  H	  oS -   v •  M     g7frf   rg   )rB   r6   s     r   rC   Ú%_preprocess_inputs.<locals>.<genexpr>�  s   é € Ð%¢1˜R�q–&¢1ùs   ‚N)Ú
isinstancer=   r,   r0   Ú	TypeErrorr   r&   ÚoperatorÚindexrN   r-   r*   r+   ÚdiffrO   ÚuniqueÚisfiniteÚallÚunravel_indexÚaranger   ÚTrl   ÚemptyrŽ   rP   ÚfillÚnan)r/   Út_tplr+   Úkir4   r5   r6   r7   r*   rt   r#   r.   Útirh   r$   s                  r   r!   r!   W  sH  € ô �eœU×#Ñ#Üð  Ø %˜w ið1ó 
ð 	
ô
 ˆu‹:€DðÜˆAŒô
 	�
Š
±Ó3²¨2”H—N’N 2Ö&±Ñ3¼2¿8¹8ÑD€Aä
ˆ1ƒv�ƒ~Ü˜9¤S¨£Z L°´S¸³V±K¸qÐAÓBÐBô ˆu‹:€DÜ�4�[ˆÜ�ZŠZ˜™Ó!ˆØ‰TˆØ�H‰H�Q‰K˜"Ñ˜qÑ ˆØ�‹6ÜÐ:¸1¸#ð >*ð +ó ,ð ,à�7‰7�a‹<ÜÐ8¸¸ð <1ð 2ó 3ð 3à�A‰v‹:Ü˜~¨a°©d°Q©h¨Zð 8!Ø!#  N°1°#°Qð8ó 9ð 9ä�GŠG�B‹K˜!‰O× Ñ ×"Ñ"ÜÐ2°1°#ð 66ð 7ó 8ð 8äŒr�yŠy˜˜q 1™u˜Ó&Ó'¨!Ó+Üð  +Ø+,¨#¨Qð0ó 1ð 1ä�{Š{˜2‹×"Ñ"×$Ô$ÜÐ2°1°#ð 6.ð /ó 0ð 0ñ) ô2 Ñ%¡1Ó%Ó%€EÜ×ÒœrŸyšy¬¨e«Ó5°uÓ=€GÜ—:’:˜g¬R¯X©XÑ6×8Ñ8×=Ñ=Ó?€Lñ %*Ó*¢E˜qŒR�ZŠZ˜Ž]¡E€EÐ*Üˆu‹:€DÙ$Ó%šu˜ŒS�ŽW™u€EÐ%Ü	�Š�4œ˜U›Ð$¬EÑ	2€BØ‡G�GŒB�F‰F„OÜ�4Ž[ˆØ %¡ˆˆnŒs�5‘8‹}ˆnÐÓñ ä�JŠJ�u¤B§H¡HÑ-€Eà˜R˜KÐ'Ð'øôm ó àˆD�‰I‹ðüò 4ùòR +ùâ%s#   ±M( Á M?Ê NÊ?N	Í(M<Í;M<c           
      óF  • [         R                  " UR                  [         R                  5      (       a6  [	        XR
                  U40 UD6n[	        XR                  U40 UD6nUSU-  -   $ UR                  S:X  a�  UR                  S   S:w  an  [         R                  " U5      n[        UR                  S   5       H:  nU" XS S 2U4   40 UD6u  US S 2U4'   nUS:w  d  M%  [        SU< SU< SU S35      e   U$ U" X40 UD6u  phUS:w  a  [        SU< S	U< S35      eU$ )
Ny              ð?rž   r   r   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  € ô
 
‡}‚}�Q—W‘Wœb×0Ñ0×1Ñ1Ü˜1Ÿf™f fÑ<°Ñ<ˆÜ˜1Ÿf™f fÑ<°Ñ<ˆØ�b˜‘g‰~Ðà‡v�v�ƒ{�q—w‘w˜q‘z A“~Ü�mŠm˜AÓˆÜ�q—w‘w˜q‘zÖ"ˆAÙ$ Qª!¨Q¨$©Ñ?°;Ñ?‰OˆC’�1�‰I�tØ�q�yÜ  I F¡;Ð.>¸±x¸|ÈAÈ3ÈaÐ!PÓQÐQñ #ð ˆ
á˜1Ñ/ ;Ñ/‰	ˆØ�1‹9Ü 	 ™{Ð*;°D±9¸AÐ>Ó?Ð?Øˆ
r   ©r¸   c                ó”  ^ ^• [        T 5      n[        S T  5       5      n [        T5        [        T 5       HN  u  px[        [        R
                  " U5      5      n	U	TU   ::  d  M/  [        SU	 SU STU    STU   S-    S3	5      e   [        UU 4S j[        U5       5       5      n
[        R                  " [        R                  " T 6  Vs/ s H  o»PM     sn[        S	9n[        R                  XÊT5      nTS
   S:¼  a  UR                  5         UR                  n[!        USU 5      [!        XåS 5      4nUR#                  U5      nU[$        R&                  :w  a$  [(        R*                  " [,        US9nSU;  a  SUS'   U" UU40 UD6nUR#                  XnUS -   5      n[        U
UT5      $ ! [         a
    T4U-  m GN•f = fs  snf )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   #   • U  H  n[        U5      v •  M     g 7fr<   )r0   )rB   Úxs     r   rC   Úmake_ndbspl.<locals>.<genexpr>Ü  s   é € Ð,¢V ”S˜—V�V¢Vùs   ‚z
There are z points in dimension z, but order z requires at least  r   z points per dimension.c              3   óv   >#   • U  H.  n[        [        R                  " TU   [        S 9TU   5      v •  M0     g7f)r   N)r
   r   r&   rP   )rB   r4   r/   Úpointss     €€r   rC   rÁ   ë  s5   øé € ð $Ú"�!ô œ"Ÿ*š* V¨A¡Y´eÑ<¸aÀ¹d×CÐCÚ"ùs   ƒ69r   r   é   Nr½   Úatolg�íµ ÷Æ°>)r0   r=   r¢   r�   r   Ú
atleast_1dr,   r-   r&   Ú	itertoolsÚproductrP   r   rv   Úeliminate_zerosr*   r   rQ   ÚsslÚspsolveÚ	functoolsÚpartialr³   )rÃ   Úvaluesr/   r¸   r¹   r+   rY   r4   ÚpointÚnumptsr.   Úxvro   ÚmatrÚv_shapeÚ
vals_shapeÚvalsÚcoefs   ` `               r   Úmake_ndbsplr×   ¼  s×  ù€ ô> ˆv‹;€DÜÑ,¡VÓ,Ó,€HðÜˆAŒô
 ˜fÖ%‰ˆÜ”R—]’] 5Ó)Ó*ˆØ�Q�q‘T�>Ü˜z¨&¨Ð1FÀqÀcð J+Ø+,¨Q©4¨&ð 1!Ø!" 1¡ a¡ Ð(>ð@ó Að Añ &ô 	õ $Ü˜T”{ó$ó 	$€Aä�JŠJ¤Y×%6Ò%6¸Ñ%?Ó@Ò%?˜ršÑ%?Ñ@ÌÑN€Eô ×"Ñ" 5¨QÓ/€Dð 	ˆ�tˆqƒyØ×ÑÔð
 �l‰l€GÜ�w˜u �~Ó&¬¨W°U¨^Ó(<Ð=€JØ�>‰>˜*Ó%€Dà”—‘ÓÜ×"Ò"¤;°vÑ>ˆØ˜Ó$à"&ˆK˜Ñá�$˜Ñ, Ñ,€DØ�<‰<˜¨4¨5 >Ñ1Ó2€DÜ�Q˜˜aÓ Ð øôM ó àˆD�‰I‹ðüò As   ¡F. ÃGÆ.GÇG)rÄ   )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×   rg   r   r   Ú<module>rä      sŽ   ðÛ Û Û Û å Ý å ç !Ð !Ý "ß Bç +àˆ-€òñ Ø˜5ð	Dðñ÷r
ð r
óðr
òh	J(ðZ !Ÿ[™[ô ð0J!¨s¯{©{÷ J!r   