
    doi                     h    S SK rS SKJr  S SKJr  SSKJr  SSKJ	r
JrJr  S rS rS	 rS
 r	S rS rg)    N)LinAlgError)dgesv   )_monomial_powers_impl)_build_system_build_evaluation_coefficients_polynomial_matrixc           	          [        XX#XEU5      $ N)&_pythran_build_evaluation_coefficients)xykernelepsilonpowersshiftscalexps           [/var/www/html/land-ocr/venv/lib/python3.13/site-packages/scipy/interpolate/_rbfinterp_np.pyr   r      s     2	fve     c                     [        X5      $ r   )_pythran_polynomial_matrix)r   r   r   s      r   polynomial_matrixr      s    %a00r   c                     [        X5      n[        R                  " U[        R                  S9n[	        U5      S:X  a  UR                  SU 5      nU$ )N)dtyper   )r   npasarrayint64lenreshape)ndimdegreer   outs       r   _monomial_powersr$      s@    

-C
**S
)C
3x1}kk!T"Jr   c                     [        XX#XE5      $ r   )_pythran_build_system)r   d	smoothingr   r   r   r   s          r   r   r   !   s     y'JJr   c           	      D   [        XX#XEU5      u  pxp[        XxSSS9u    pnUS:  a  [        SU*  S35      eUS:  aa  SnUR                  S   nUS:  a?  [	        X	-
  U
-  XV5      n[
        R                  R                  U5      nUU:  a	  SU SU S	3n[        U5      eXU4$ )
a  Build and solve the RBF interpolation system of equations.

Parameters
----------
y : (P, N) float ndarray
    Data point coordinates.
d : (P, S) float ndarray
    Data values at `y`.
smoothing : (P,) float ndarray
    Smoothing parameter for each data point.
kernel : str
    Name of the RBF.
epsilon : float
    Shape parameter.
powers : (R, N) int ndarray
    The exponents for each monomial in the polynomial.

Returns
-------
coeffs : (P + R, S) float ndarray
    Coefficients for each RBF and monomial.
shift : (N,) float ndarray
    Domain shift used to create the polynomial matrix.
scale : (N,) float ndarray
    Domain scaling used to create the polynomial matrix.

T)overwrite_aoverwrite_br   zThe z"-th argument had an illegal value.zSingular matrix.zqSingular matrix. The matrix of monomials evaluated at the data point coordinates does not have full column rank (/z).)	r   r   
ValueErrorshaper   r   linalgmatrix_rankr   )r   r'   r(   r   r   r   r   lhsrhsr   r   _coeffsinfomsgnmonospmatranks                     r   _build_and_solve_systemr:   %   s    8 +	i"
Ce sTtLAq$ax4w&HIJJ	 aA:$ai%6CD99((.Df}!F!F82/  #r   c	           
      &    [        XX#XEXh5      n	X-  $ r   )r   )
r   r   r   r   r   r   r   r4   r   vecs
             r   compute_interpolationr=   X   s    
(	fveC <r   )numpyr   numpy.linalgr   scipy.linalg.lapackr   _rbfinterp_commonr   _rbfinterp_pythranr   r&   r   r   r	   r   r   r$   r:   r=    r   r   <module>rD      s;     $ % 4 1K1 fr   