
    \ci                     j    d dl Zd dlmZ d dlmZ ddlmZ ddlm	Z
mZmZ d Zd Zd	 Zd
 Z	d Zd ZdS )    N)LinAlgError)dgesv   )_monomial_powers_impl)_build_system_build_evaluation_coefficients_polynomial_matrixc           	      ,    t          | ||||||          S N)&_pythran_build_evaluation_coefficients)xykernelepsilonpowersshiftscalexps           o/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/scipy/interpolate/_rbfinterp_np.pyr   r      s%     2	1fgvue      c                 "    t          | |          S r   )_pythran_polynomial_matrix)r   r   r   s      r   polynomial_matrixr      s    %a000r   c                     t          | |          }t          j        |t          j                  }t	          |          dk    r|                    d|           }|S )N)dtyper   )r   npasarrayint64lenreshape)ndimdegreer   outs       r   _monomial_powersr$      sN    
f
-
-C
*S
)
)
)C
3xx1}}kk!T""Jr   c                 *    t          | |||||          S r   )_pythran_build_system)r   d	smoothingr   r   r   r   s          r   r   r   !   s     Ay&'6JJJr   c           	         t          | ||||||          \  }}}	}
t          ||dd          \  }}}}|dk     rt          d|  d          |dk    rid}|j        d         }|dk    rEt	          | |	z
  |
z  ||          }t
          j                            |          }||k     r	d| d| d	}t          |          |	|
|fS )
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 +	1i&"
 
CeU sCTtLLLAq&$axxIIIIJJJ	 aA::$a%i%6CCD9((..Df}}/!/ /$*/ / /  #%r   c	           
      8    t          | |||||||          }	|	|z  S r   )r   )
r   r   r   r   r   r   r   r4   r   vecs
             r   compute_interpolationr=   X   s.    
(	1fgvueR 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 4 4 4 4 4           1 1 1  K K K1  1  1 f    r   