mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-27 21:20:27 -04:00
fft prototype code for real fft works
This commit is contained in:
parent
968e277f93
commit
63e7df14cf
22
fft.py
22
fft.py
@ -42,10 +42,27 @@ def fft(f,inv):
|
||||
|
||||
return Fout
|
||||
|
||||
def rifft(F):
|
||||
N = len(F) - 1
|
||||
Z = [0] * (N)
|
||||
for k in range(N):
|
||||
Fek = ( F[k] + F[-k-1].conjugate() )
|
||||
Fok = ( F[k] - F[-k-1].conjugate() ) * e ** (j*pi*k/N)
|
||||
Z[k] = Fek + j*Fok
|
||||
|
||||
#print 'Z', Z
|
||||
|
||||
fp = fft(Z , 1)
|
||||
|
||||
f = []
|
||||
for c in fp:
|
||||
f.append(c.real)
|
||||
f.append(c.imag)
|
||||
return f
|
||||
|
||||
def real_fft( f,inv ):
|
||||
if inv:
|
||||
sys.stderr.write('not impl\n')
|
||||
sys.exit(1)
|
||||
return rifft(f)
|
||||
|
||||
N = len(f) / 2
|
||||
|
||||
@ -54,6 +71,7 @@ def real_fft( f,inv ):
|
||||
|
||||
fp = [ complex(r,i) for r,i in zip(res,ims) ]
|
||||
Fp = fft( fp ,0 )
|
||||
#print 'F=',Fp
|
||||
|
||||
F = []
|
||||
for k in range(N):
|
||||
|
Loading…
Reference in New Issue
Block a user