
    _Mh                         d dl Zd dlmZ ddlmZmZ ddlmZm	Z	 d dl
mZ g dZ ej        d          Zdd
ZddZddZddZddddZdS )    N)warn   )rfftirfft   )loggammapoch)array_namespace)fhtifht	fhtoffset        c           	         t          |           }|                    |           } | j        d         }|dk    rF|dz
  dz  }|                    ||j                  }| |                    | ||z
  z  |z            z  } |                    t          |||||                    }	t          | |	|          }
|dk    r%|
|                    | ||z
  |z  |z   z            z  }
|
S )Nr   r   r   dtype)offsetbiasxpr
   asarrayshapearangefloat64expfhtcoeff_fhtq)adlnmur   r   r   nj_cjuAs              Y/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/scipy/fft/_fftlog_backend.pyr   r      s    			B


1A 	
A qyysAgIIarzI**ua#gs*+++ 	

8AsBvDAAABBA 	arA qyy	RVVTEAGS=612333H    c           
         t          |           }|                    |           } | j        d         }|dk    rH|dz
  dz  }|                    ||j                  }| |                    |||z
  |z  |z   z            z  } |                    t          |||||d                    }	t          | |	d|          }
|dk    r"|
|                    | ||z
  z  |z            z  }
|
S )	Nr   r   r   r   r   T)r   r   inverse)r*   r   r   )r&   r    r!   r   r   r   r"   r#   r$   r%   r   s              r'   r   r   *   s    			B


1A 	
A qyysAgIIarzI**ta#gs]V34555 	

8AsBvD$OOOPPA 	aDR(((A qyy	RVVTE1s7OC'(((Hr(   Fc                 B   ||}}|dz   |z   dz  }|dz   |z
  dz  }	t          j        dt           j        | dz  z  | |z  z  | dz  dz             }
t          j        | dz  dz   t                    }t          j        | dz  dz   t                    }|
|j        dd<   |	|j        dd<   t          ||           ||j        dd<   t          ||           |
dt          |z
  z  z  }
|xj        |j        z  c_        |xj        t          |z  z  c_        |xj        |j        z  c_        |xj        |
z  c_        t          j	        ||           | dz  dk    r
d|j        d<   t          j
        |d                   sd|z  t          |	||	z
            z  |d<   t          j        |d                   r-|s+t          dd	
           t          j        |          }d|d<   nB|d         dk    r6|r4t          dd	
           t          j        |          }t           j        |d<   |S )z:Compute the coefficient array for a fast Hankel transform.r   r   r   r   N)outr   z.singular transform; consider changing the bias   )
stacklevelz6singular inverse transform; consider changing the bias)nplinspacepiemptycompleximagrealr   LN_2r   isfiniter	   isinfr   copyinf)r"   r    r!   r   r   r*   lnkrqr   xmyr%   vs                r'   r   r   F   s4   d!D
 Q$q&!B
Q$q&!B
Aruad|QsU+QT!V44A
Aaw'''A
Aaw'''AAF111IAF111IQAAF111IQAD4KAFFafFFFFd1fFFFFafFFFFaKFFF1! 	1uzzr
 ;qt & !td2r"uoo%!
 
x!~~ 	g 	=!LLLLGAJJ!	
1wERSTTTTGAJJv!Hr(   c                 <   ||}}|dz   |z   dz  }|dz   |z
  dz  }t           j        d| z  z  }t          |d|z  z             }	t          |d|z  z             }
t          |z
  | z  |	j        |
j        z   t           j        z  z   }||t          j        |          z
  | z  z   S )a  Return optimal offset for a fast Hankel transform.

    Returns an offset close to `initial` that fulfils the low-ringing
    condition of [1]_ for the fast Hankel transform `fht` with logarithmic
    spacing `dln`, order `mu` and bias `bias`.

    Parameters
    ----------
    dln : float
        Uniform logarithmic spacing of the transform.
    mu : float
        Order of the Hankel transform, any positive or negative real number.
    initial : float, optional
        Initial value for the offset. Returns the closest value that fulfils
        the low-ringing condition.
    bias : float, optional
        Exponent of power law bias, any positive or negative real number.

    Returns
    -------
    offset : float
        Optimal offset of the uniform logarithmic spacing of the transform that
        fulfils a low-ringing condition.

    Examples
    --------
    >>> from scipy.fft import fhtoffset
    >>> dln = 0.1
    >>> mu = 2.0
    >>> initial = 0.5
    >>> bias = 0.0
    >>> offset = fhtoffset(dln, mu, initial, bias)
    >>> offset
    0.5454581477676637

    See Also
    --------
    fht : Definition of the fast Hankel transform.

    References
    ----------
    .. [1] Hamilton A. J. S., 2000, MNRAS, 312, 257 (astro-ph/9905191)

    r   r   y              ?)r/   r1   r   r6   r4   round)r    r!   initialr   r;   r<   r   r=   r>   zpzmargs               r'   r   r   y   s    \ t!D
Q$q&!B
Q$q&!B
quA	"r!t)		B	"r!t)		B$;
rw0"%7
7C3#&+++r(   r   c                    |t           }| j        d         }t          | d          }|s||z  }n||                    |          z  }t	          ||d          }|                    |d          }|S )zUCompute the biased fast Hankel transform.

    This is the basic FFTLog routine.
    Nr   )axis)r/   r   r   conjr   flip)r   r%   r*   r   r"   r&   s         r'   r   r      s    
 
z 	
A 	QRA 	Q 	
RWWQZZaA
AHr(   )r   r   )r   r   F)F)numpyr/   warningsr   _basicr   r   specialr   r	   scipy._lib._array_apir
   __all__logr6   r   r   r   r   r    r(   r'   <module>rR      s                      $ $ $ $ $ $ $ $ 1 1 1 1 1 1
&
&
& rvayy   8   80 0 0 0f6, 6, 6, 6,rT       r(   