U
    /d5                     @   sj   d Z ddlZz"ddlZddlmZ edZW n ek
rB   Y nX dd ZdZdd	 Z	e
d
krfe	  dS )zPrecompute the polynomials for the asymptotic expansion of the
generalized exponential integral.

Sources
-------
[1] NIST, Digital Library of Mathematical Functions,
    https://dlmf.nist.gov/8.20#ii

    N)Polyxc                 C   s^   t dtg}t| D ]D}|t dd| t  t||  t ttd  ||     q|S )N      )r   r   rangeappendZdiff)KAk r   F/tmp/pip-unpacked-wheel-9gxwnfpp/scipy/special/_precompute/expn_asy.py
generate_A   s    Br   ze/* This file was automatically generated by _precompute/expn_asy.py.
 * Do not edit it manually!
 */
c               	   C   s   t t tjddd} d}t|}t| d d}|t |d	t
| t|D ]2\}}dd	d
 | D }|d	|| qZddd
 t|d D }|d	| ddd
 |D }|d	| W 5 Q R X t| d |  d S )Nz..Zcepheszexpn.h   z.newwz#define nA {}
z, c                 S   s   g | ]}t |d qS )   )strZevalf).0r   r   r   r   
<listcomp>,   s     zmain.<locals>.<listcomp>z$static const double A{}[] = {{{}}};
c                 S   s   g | ]}d  |qS )zA{})format)r   r
   r   r   r   r   .   s     r   z#static const double *A[] = {{{}}};
c                 S   s   g | ]}t | qS r   )r   Zdegree)r   Akr   r   r   r   0   s     z#static const int Adegs[] = {{{}}};
)print__doc__ospathjoinr   openwriteWARNINGr   len	enumerateZcoeffsr   rename)fnr   r	   fr
   r   tmpr   r   r   main"   s    
r$   __main__)r   r   Zsympyr   symbolsr   ImportErrorr   r   r$   __name__r   r   r   r   <module>   s   	