Function iadftmatrix

Synopse

Kernel matrix for the 1-D Discrete Fourier Transform DFT.

  • A = iadftmatrix(N)
    • A: Output image, square N x N, complex
    • N: Integer, number of points of the DFT
1. from numpy import *
2. 
3. def iadftmatrix(N):
4.     x = arange(N).reshape(N,1)
5.     u = x
6.     Wn = exp(-1j*2*pi/N)
7.     A = (1./sqrt(N)) * (Wn ** dot(u, x.T))
8.     return A

Examples

Example 1

1. from ia636 import iadftmatrix, ianormalize
2. 
3. A = iadftmatrix(128)
4. adshow(ianormalize(A.real),'A.real')
5. adshow(ianormalize(A.imag),'A.imag')

A.real

A.imag

Example 2

1. A = iadftmatrix(4)
2. print 'A=\n', A.round(1)
3. print 'A-A.T=\n', A - A.T
4. print (abs(linalg.inv(A)-conjugate(A))).max() < 10E-15
A=
[[ 0.5+0.j   0.5+0.j   0.5+0.j   0.5+0.j ]
 [ 0.5+0.j   0.0-0.5j -0.5-0.j  -0.0+0.5j]
 [ 0.5+0.j  -0.5-0.j   0.5+0.j  -0.5-0.j ]
 [ 0.5+0.j  -0.0+0.5j -0.5-0.j   0.0-0.5j]]
A-A.T=
[[ 0.+0.j  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j]
 [ 0.+0.j  0.+0.j  0.+0.j  0.+0.j]]
True

Example 3

Showing the product x u.T

1. u = x = arange(10).reshape(10,1)
2. print 'u xT=\n', dot( u, x.T)
u xT=
[[ 0  0  0  0  0  0  0  0  0  0]
 [ 0  1  2  3  4  5  6  7  8  9]
 [ 0  2  4  6  8 10 12 14 16 18]
 [ 0  3  6  9 12 15 18 21 24 27]
 [ 0  4  8 12 16 20 24 28 32 36]
 [ 0  5 10 15 20 25 30 35 40 45]
 [ 0  6 12 18 24 30 36 42 48 54]
 [ 0  7 14 21 28 35 42 49 56 63]
 [ 0  8 16 24 32 40 48 56 64 72]
 [ 0  9 18 27 36 45 54 63 72 81]]

Equation

See Also