o
    g5                     @   sl   d Z ddlZzddlZddlmZ edZW n	 ey    Y nw dd ZdZdd	 Z	e
d
kr4e	  dS 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 ]"}|t dd| t  t||  t ttd  ||     q
|S )N      )r   r   rangeappenddiff)KAk r   `/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/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 ]\}}dd	d
 | D }|d	|| q-ddd
 t|d D }|d	| ddd
 |D }|d	| W d    n1 syw   Y  t| d |  d S )Nz..cepheszexpn.h   z.newwz#define nA {}
z, c                 S   s   g | ]	}t |d qS )   )str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   degree)r   Akr   r   r   r   0   s    z#static const int Adegs[] = {{{}}};
)print__doc__ospathjoinr   openwriteWARNINGr   len	enumeratecoeffsr   rename)fnr	   r
   fr   r   tmpr   r   r   main"   s    

r)   __main__)r   r   sympyr   symbolsr   ImportErrorr   r!   r)   __name__r   r   r   r   <module>   s    	
