
     hu&                        d Z ddlZ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dd	Z ej        ed
          Zde_         ej        ed          Zde_        	 	 d&dddZ ej        ed
          Zde_         ej        ed          Zde_        	 	 d&dddZ ej        ed
          Zde_         ej        ed          Zde_        d'dddZd'dddZd'dddZd'dddZd'dddZd'dddZ	 	 d(dddZ  ej        e d
          Z!de!_         ej        e d          Z"de"_        	 	 d(dddZ# ej        e#d
          Z$de$_         ej        e#d          Z%de%_        	 	 d(ddd Z& ej        e&d
          Z'd!e'_         ej        e&d          Z(d"e(_        d)d#Z) ej        e)d
          Z*d$e*_         ej        e)d          Z+d%e+_        dS )*z(
Discrete Fourier Transforms - basic.py
    N   )pypocketfft)	_asfarray_init_nd_shape_and_axes_datacopied
_fix_shape_fix_shape_1d_normalization_workersF)planc                   |t          d          t          |          }|pt          ||          }t          ||           }t	          |          }|t          |||          \  }}	|p|	}n>|j        |         dk     r-t          d                    |j        |                             |r|j	        j
        dk    r|nd}
t          j        ||f| ||
|          S )z@ Return discrete Fourier transform of real or complex sequence. NFPassing a precomputed plan is not yet supported by scipy.fft functionsr   -invalid number of data points ({0}) specifiedc)NotImplementedErrorr   r   r
   r   r	   shape
ValueErrorformatdtypekindpfftc2c)forwardxnaxisnormoverwrite_xworkersr   tmpcopiedouts              V/var/www/html/Sam_Eipo/venv/lib/python3.11/site-packages/scipy/fft/_pocketfft/basic.pyr   r      s     ! #E F F 	F
A,,C4S!!4!4K$((DwG}#CD11V!+V	41		H &4113 3 	3 A#).C"7"733TC8C$'4g>>>    Tfftifftc                   |t          d          t          |          }t          ||           }t          |          }t	          j        |          st          d          |t          |||          \  }}	n>|j        |         dk     r-t          d
                    |j        |                             t          j        ||f| |d|          S )z8
    Discrete Fourier transform of a real sequence.
    Nr   x must be a real sequencer   r   )r   r   r
   r   np	isrealobj	TypeErrorr	   r   r   r   r   r2c
r   r   r   r   r   r   r    r   r!   _s
             r$   r-   r-   (   s    
 ! #E F F 	F
A,,C$((DwG< 53444}sAt,,QQ	41		H &4113 3 	3 8C$'4w???r%   rfftihfftc          	         |t          d          t          |          }t          ||           }t          |          }t	          j        |          r|dz   }|<|j        |         dz
  dz  }|dk     r"t          d                    |                    nt          ||dz  dz   |          \  }}	t          j        ||f|| |d|          S )zG
    Return inverse discrete Fourier transform of real sequence x.
    Nr                   r      z-Invalid number of data points ({0}) specified)r   r   r
   r   r*   r+   r   r   r   r	   r   c2rr.   s
             r$   r5   r5   G   s    
 ! #E F F 	F
A,,C$((DwG 
|C Ci 	yYt_q A%q55L$fQii) ) )  sQTQJ55Q 8C$!WdD'BBBr%   hfftirfftr   c                L    |t          d          t          | |||||          S )z)
    2-D discrete Fourier transform.
    Nr   )r   fftnr   saxesr   r   r    r   s          r$   fft2r?   j   s=    
 ! #E F F 	F1dD+w777r%   c                L    |t          d          t          | |||||          S )zM
    2-D discrete inverse Fourier transform of real or complex sequence.
    Nr   )r   ifftnr<   s          r$   ifft2rB   u   =    
 ! #E F F 	FAtT;888r%   c                L    |t          d          t          | |||||          S )z;
    2-D discrete Fourier transform of a real sequence
    Nr   )r   rfftnr<   s          r$   rfft2rF      rC   r%   c                L    |t          d          t          | |||||          S )zC
    2-D discrete inverse Fourier transform of a real sequence
    Nr   )r   irfftnr<   s          r$   irfft2rI      =    
 ! #E F F 	F!QdK999r%   c                L    |t          d          t          | |||||          S )z@
    2-D discrete Fourier transform of a Hermitian sequence
    Nr   )r   hfftnr<   s          r$   hfft2rM      rC   r%   c                L    |t          d          t          | |||||          S )zH
    2-D discrete inverse Fourier transform of a Hermitian sequence
    Nr   )r   ihfftnr<   s          r$   ihfft2rP      rJ   r%   c                   |t          d          t          |          }t          |||          \  }	}|pt          ||          }t	          |          }t          |          dk    r|S t          ||	|          \  }}
|p|
}t          ||           }|r|j        j	        dk    r|nd}t          j        ||| |||          S )z=
    Return multidimensional discrete Fourier transform.
    Nr   r   r   )r   r   r   r   r   lenr   r
   r   r   r   r   )r   r   r=   r>   r   r   r    r   r!   r   r"   r#   s               r$   c2cnrS      s    
 ! #E F F 	F
A,,C)#q$77KE44S!!4!4KwG
4yyA~~S%..KC'K$((DA#).C"7"733TC8Cwc7;;;r%   r;   rA   c                   |t          d          t          |          }t          j        |          st	          d          t          |||          \  }	}t          ||	|          \  }}
t          ||           }t          |          }t          |          dk    rt          d          t          j        ||| |d|          S )z@Return multidimensional discrete Fourier transform of real inputNr   r)   r   #at least 1 axis must be transformed)r   r   r*   r+   r,   r   r   r
   r   rR   r   r   r-   )r   r   r=   r>   r   r   r    r   r!   r   r/   s              r$   r2cnrV      s     ! #E F F 	F
A,,C< 53444)#q$77KE4UD))FC$((DwG
4yyA~~>??? 8CwdG<<<r%   rE   rO   c          	         |t          d          t          |          }t          j        |          r|dz   }|du }	t	          |||          \  }
}t          |          dk    rt          d          |	r|j        |d                  dz
  dz  |
d<   t          ||           }t          |          }|
d         }|
d         dz  dz   |
d<   t          ||
|          \  }}t          j        |||| |d|          S )	zDMultidimensional inverse discrete fourier transform with real outputNr   r3   r   rU   r   r   r4   )r   r   r*   r+   r   rR   r   r   r
   r   r   r   r5   )r   r   r=   r>   r   r   r    r   r!   noshaper   lastsizer/   s                r$   c2rnrZ      s    ! #E F F 	F
A,,C 
|C Ci4iG)#q$77KE4
4yyA~~>??? 0WT"X&*a/b	$((DwG RyHra1$E"IUD))FC 8Cx$gFFFr%   rL   rH   c           	         t          |          }|pt          ||          }t          ||           }t          d          }|j        j        dk    rt          d          |t          |||          \  }}|p|}n>|j        |         dk     r-t          d
                    |j        |                             |r|nd}	t          j        ||f| | ||	|          S )z=FFT of a real sequence, returning fftpack half complex formatNr   r)   r   r   )r   r   r
   r   r   r   r,   r	   r   r   r   r   r2r_fftpack)
r   r   r   r   r   r   r!   r    r"   r#   s
             r$   r\   r\     s    
A,,C4S!!4!4K$((DtnnG
y~3444}#CD11V!+V	41		H &4113 3 	3 '334CC$'7D#wOOOr%   rfft_fftpackirfft_fftpack)Nr   NFN)Nr8   NFN)NNNFN)Nr   NF),__doc__numpyr*   	functools r   r   helperr   r   r   r   r	   r
   r   r   partialr&   __name__r'   r-   r0   r1   r5   r6   r7   r?   rB   rF   rI   rM   rP   rS   r;   rA   rV   rE   rO   rZ   rL   rH   r\   r]   r^    r%   r$   <module>rg      s            ! ! ! ! ! !                  =B?"? ? ? ? ?. iT""ye$$ =B@"@ @ @ @ @2 yd##	#u%% =BC"C C C C C: yd##	#u%%88 8 8 8 899 9 9 9 999 9 9 9 9:: : : : :99 9 9 9 9:: : : : : @E<#< < < < <4 yt$$	$&&?D=#= = = = =. 		$%%		4	'	' @EG#G G G G GD 		$%%		4	'	'P P P P, !y d33& !	!+u55(   r%   