o
    g                     @   s   d Z ddlZddlmZmZmZ ddlmZmZm	Z	m
Z
mZmZ ddlmZ dZdd Zd	d
 Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Z d)d* Z!d+d, Z"dS )-z Test functions for rbf module     N)assert_assert_array_almost_equalassert_almost_equal)linspacesincosrandomexpallclose)Rbfmultiquadriczinverse multiquadricgaussiancubicquinticz
thin-platelinearc                 C   sR   t ddd}t|}t||| d}||}t|| t|t|d |d  d S )Nr   
   	   function)r   r   r   r   r   float)r   xyrbfyi r   ^/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/scipy/interpolate/tests/test_rbf.pycheck_rbf1d_interpolation   s   
r   c                 C   sx   t ddd d }t ddd d }|t|d  d|d    }t|||d| d}|||}|j|_t|| d S )N2                          ?epsilonr   r   randr	   r   shaper   )r   r   r   zr   zir   r   r   check_rbf2d_interpolation   s   
r*   c                 C   s   t ddd d }t ddd d }t ddd d }|t|d  |d   }t||||d| d}||||}|j|_t|| d S )Nr   r   r    r!   r#   r%   )r   r   r   r(   dr   dir   r   r   check_rbf3d_interpolation#   s   r-   c                  C   &   t D ]} t|  t|  t|  qd S N)	FUNCTIONSr   r*   r-   r   r   r   r   test_rbf_interpolation/   
   
r1   c                 C   sl   t ddd}t|}t|}t||gj}t||| dd}||}t|| t|t	|d |d  d S )Nr   r   r   N-Dr   mode)
r   r   r   npvstackTr   r   r   r   )r   r   y0y1r   r   r   r   r   r   check_2drbf1d_interpolation6   s   
r;   c                 C   s   t dd d }t dd d }|t|d  d|d    }|t|d  d|d    }t||gj}t|||d| dd}|||}|j|_t|| d S )Nr   r    r!   r"   r3   r$   r   r5   	r   r&   r	   r6   r7   r8   r   r'   r   )r   r   r   z0z1r(   r   r)   r   r   r   check_2drbf2d_interpolationB   s   
r@   c           	   	   C   s   t dd d }t dd d }t dd d }|t|d  |d   }|t|d  |d   }t||gj}t||||d| dd}||||}|j|_t|| d S )Nr   r    r!   r3   r<   r=   )	r   r   r   r(   d0d1r+   r   r,   r   r   r   check_2drbf3d_interpolationO   s   rC   c                  C   r.   r/   )r0   r;   r@   rC   r   r   r   r   test_2drbf_interpolation]   r2   rD   c                 C   sj   t ddd}t|}t||| d}t ddd}||}dt|t|   }tt|t||d| d S )Nr   r   r   r   d   abs-diff: %fatol)r   r   r   absmaxr   r
   )r   rH   r   r   r   xir   msgr   r   r   check_rbf1d_regularityd   s   rM   c                  C   s4   dddddddd} t D ]}t|| |d qd S Ng?g333333?g?r   g{Gz?)r0   rM   get
tolerancesr   r   r   r   test_rbf_regularityp      	rR   c           
      C   s   t ddd}t|}t|}t||gj}t||| dd}t ddd}||}dt|tt|t|gj   }	t	t
|tt|t|gj|d|	 d S )	Nr   r   r   r3   r4   rE   rF   rG   )r   r   r   r6   r7   r8   r   rI   rJ   r   r
   )
r   rH   r   r9   r:   r   r   rK   r   rL   r   r   r   check_2drbf1d_regularity~   s   (,rT   c                  C   s4   dddddddd} t D ]}t|| |d qd S rN   )r0   rT   rO   rP   r   r   r   test_2drbf_regularity   rS   rU   c                 C   s   t jd t ddd}|dt jt|  }t||| d}t ddd}||}tt || 	 t || 	  dk  d S )	Ni  r   r   r   g      @r   i  g?)
r6   r   seedr   randnlenr   r   rI   rJ   )r   r   r(   r   rK   r   r   r   r   check_rbf1d_stability   s   0rY   c                  C   s   t D ]} t|  qd S r/   )r0   rY   r   r   r   r   test_rbf_stability   s   
rZ   c                  C   s4   t ddd} t| }t| |}|| }t|| d S )Nr   r   r   r   r   r   r   )r   r   r   r   r   r   r   test_default_construction   s
   
r\   c                  C   s@   t ddd} t| }dd }t| ||d}|| }t|| d S )Nr   r   r   c                 S   s   | S r/   r   )r   r   r   r   <lambda>   s    z+test_function_is_callable.<locals>.<lambda>r   r[   )r   r   linfuncr   r   r   r   r   test_function_is_callable   s   r_   c                  C   s@   dd } t ddd}t|}t||| d}||}t|| d S )Nc                 S   s
   | j | S r/   r$   )selfrr   r   r   _func   s   
z0test_two_arg_function_is_callable.<locals>._funcr   r   r   r   r[   )rc   r   r   r   r   r   r   r   !test_two_arg_function_is_callable   s   rd   c                  C   s&   t ddd} t| }t| |d d d S )Nr   r   r   r`   )r   r   r   )r   r   r   r   r   test_rbf_epsilon_none   s   re   c                  C   s:   g d} g d}g d}t | ||d d}t|jdk d S )N)r   r!      )r    r    r    )         r`   r   )r   r   r$   )r   r   r(   r   r   r   r   test_rbf_epsilon_none_collinear   s
   rj   )#__doc__numpyr6   numpy.testingr   r   r   r   r   r   r   r	   r
   scipy.interpolate._rbfr   r0   r   r*   r-   r1   r;   r@   rC   rD   rM   rR   rT   rU   rY   rZ   r\   r_   rd   re   rj   r   r   r   r   <module>   s2    


