
    \h.                     x    S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr   " S S\5      r " S	 S
\5      rg)    )_sympify)
MatrixExpr)I)S)exp)sqrtc                   \   ^  \ rS rSrSrU 4S jr\" S 5      r\" S 5      rS r	S r
SrU =r$ )	DFT	   a  
Returns a discrete Fourier transform matrix. The matrix is scaled
with :math:`\frac{1}{\sqrt{n}}` so that it is unitary.

Parameters
==========

n : integer or Symbol
    Size of the transform.

Examples
========

>>> from sympy.abc import n
>>> from sympy.matrices.expressions.fourier import DFT
>>> DFT(3)
DFT(3)
>>> DFT(3).as_explicit()
Matrix([
[sqrt(3)/3,                sqrt(3)/3,                sqrt(3)/3],
[sqrt(3)/3, sqrt(3)*exp(-2*I*pi/3)/3,  sqrt(3)*exp(2*I*pi/3)/3],
[sqrt(3)/3,  sqrt(3)*exp(2*I*pi/3)/3, sqrt(3)*exp(-2*I*pi/3)/3]])
>>> DFT(n).shape
(n, n)

References
==========

.. [1] https://en.wikipedia.org/wiki/DFT_matrix

c                 ^   > [        U5      nU R                  U5        [        TU ]  X5      nU$ N)r   
_check_dimsuper__new__)clsnobj	__class__s      Z/var/www/auris/envauris/lib/python3.13/site-packages/sympy/matrices/expressions/fourier.pyr   DFT.__new__*   s+    QKqgoc%
    c                      U R                   S   $ )Nr   )argsselfs    r   <lambda>DFT.<lambda>1   s    diilr   c                 2    U R                   U R                   4$ r   )r   r   s    r   r   r   2   s    466466"2r   c                     [        S[        R                  -  [        -  U R                  -  5      nXAU-  -  [        U R                  5      -  $ Nr   r   Pir   r   r   r   ijkwargsws        r   _entry
DFT._entry4   s:    144	$&& !Q3x$tvv,&&r   c                 ,    [        U R                  5      $ r   )IDFTr   r   s    r   _eval_inverseDFT._eval_inverse8   s    DFF|r    )__name__
__module____qualname____firstlineno____doc__r   propertyr   shaper)   r-   __static_attributes____classcell__)r   s   @r   r
   r
   	   s5    @ 	*+A23E' r   r
   c                   $    \ rS rSrSrS rS rSrg)r,   <   a^  
Returns an inverse discrete Fourier transform matrix. The matrix is scaled
with :math:`\frac{1}{\sqrt{n}}` so that it is unitary.

Parameters
==========

n : integer or Symbol
    Size of the transform

Examples
========

>>> from sympy.matrices.expressions.fourier import DFT, IDFT
>>> IDFT(3)
IDFT(3)
>>> IDFT(4)*DFT(4)
I

See Also
========

DFT

c                     [        S[        R                  -  [        -  U R                  -  5      nXA* U-  -  [        U R                  5      -  $ r    r"   r$   s        r   r)   IDFT._entryV   s<    144	$&& !2a4y4<''r   c                 ,    [        U R                  5      $ r   )r
   r   r   s    r   r-   IDFT._eval_inverseZ   s    466{r   r/   N)r0   r1   r2   r3   r4   r)   r-   r7   r/   r   r   r,   r,   <   s    2(r   r,   N)sympy.core.sympifyr   sympy.matrices.expressionsr   sympy.core.numbersr   sympy.core.singletonr   &sympy.functions.elementary.exponentialr   (sympy.functions.elementary.miscellaneousr   r
   r,   r/   r   r   <module>rE      s0    ' 1   " 6 90* 0f3 r   