o
    װi                     @   sH   d dl mZ d dlmZ d dlmZ dZejdddee e dd	Zd
S )    )_core)exp1_definition)math_constants_and_eula   
template < typename T >
__device__ double expi(T x) {
    T ei = 1;
    T r = 1;

    if (x == 0) {
        return -CUDART_INF;
    } else if (x < 0) {
        return -exp1(-x);
    } else if (x <= 40.0) {
        for (int k = 1; k <= 100; k++) {
            int den = (k + 1) * (k + 1);
            r = r * k * x / den;
            ei += r;
        }

        return EUL + x * ei + log(x);
    }

    for (int k = 1; k <= 40; k++) {
        r = r * k / x;
        ei += r;
    }

    return exp(x) / x * ei;
}
cupyx_scipy_special_expi)zf->fzd->dzout0 = expi(in0)a  Exponential integral Ei.

    Parameters
    ----------
    x : cupy.ndarray
        Real argument

    Returns
    -------
    y : scalar or cupy.ndarray
        Values of exponential integral

    See Also
    --------
    :func:`scipy.special.expi`

    )preambledocN)cupyr   cupyx.scipy.special._exp1r   r   expi_definitioncreate_ufuncexpi r   r   M/home/ubuntu/.local/lib/python3.10/site-packages/cupyx/scipy/special/_expi.py<module>   s   

