o
    Eb/                     @   s  d dl ZddlmZ ddlmZmZmZm	Z	m
Z
mZmZ d dlZ		ddd	Zeed
ejZde_eedejZde_eed
ejZde_eedejZde_		dddZeed
ejZde_eedejZde_eed
ejZde_eedejZde_dS )    N   )pypocketfft)	_asfarray_init_nd_shape_and_axes_datacopied
_fix_shape_fix_shape_1d_normalization_workers   Fc
                 C   s   t |}
|p
t|
|}t|| }t|}| s#|dkrd}n|dkr#d}|dur4t|
||\}
}|p2|}n|
j| dk rEtd|
j| |rI|
nd}t	|ru|du rYt
|
n|}||
j||f||j| ||
j||f||j| |S ||
||f||||	S )zForward or backward 1-D DCT/DST

    Parameters
    ----------
    forward: bool
        Transform direction (determines type and normalisation)
    transform: {pypocketfft.dct, pypocketfft.dst}
        The transform to perform
    r      Nr   z-invalid number of data points ({0}) specified)r   r   r	   r
   r   shape
ValueErrorformatnpiscomplexobj
empty_likerealimag)forward	transformxtypenZaxisnormoverwrite_xworkersorthogonalizetmpcopiedout r"   E/usr/lib/python3/dist-packages/scipy/fft/_pocketfft/realtransforms.py_r2r   s.   


r$   Tdctidctdstidstc
                 C   s   t |}
t|
||\}}|pt|
|}t|dkr|S t|
||\}
}|p&|}| s6|dkr0d}n|dkr6d}t|| }t|}|rC|
nd}t|rm|du rSt	|
n|}||
j
||||j
| ||
j||||j| |S ||
||||||	S )zForward or backward nd DCT/DST

    Parameters
    ----------
    forward: bool
        Transform direction (determines type and normalisation)
    transform: {pypocketfft.dct, pypocketfft.dst}
        The transform to perform
    r   r   r   N)r   r   r   lenr   r	   r
   r   r   r   r   r   )r   r   r   r   sZaxesr   r   r   r   r   r   r    r!   r"   r"   r#   _r2rn<   s*   

r+   dctnidctndstnidstn)r   Nr   NFNN)r   NNNFNN)Znumpyr    r   Zpffthelperr   r   r   r   r   r	   r
   	functoolsr$   partialr%   __name__r&   r'   r(   r+   r,   r-   r.   r/   r"   r"   r"   r#   <module>   s4    $
)
*
