building fft
 otlore dolire
[
Home
]
[ Index:
by date

by threads
]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
[ Message by date: previous  next ] [ Message in thread: previous  next ] [ Thread: previous  next ]
Date:   (:) 
From:  otlore dolire <otlore@h...> 
Subject:  building fft 
I have a problem with a basic fft function i'm tryin to build. I think it's right, yet it raises conflicts, as if it didn't recognize the "end" at the end of it. Can you please tell me if someone sees something wrong? thx in advance let rec fft N w y = let Y = make_vect N {Re = 0. ; Im = 0.} in if N = 1 then begin Y.(0) < y.(0) end else begin let m = div_int N 2; let l1 = make_vect m {Re = 0. ; Im = 0. } and l2 = make_vect m {Re = 0. ; Im = 0. } in for k = 0 to m  1 do l1.(k) < y.(2*k); l2.(k) < y.(2*k + 1) done; let L1 = make_vect m {Re = 0. ; Im = 0. } and L2 = make_vect m {Re = 0. ; Im = 0. } in for i = 0 to m  1 do L1.(i) < (fft m (prod w w) l1).(i); L2.(i) < (fft m (prod w w) l2).(i) done; let wk = ref {Re = 1. ; Im = 0. } and P = ref {Re = 0. ; Im = 0. } and I = ref {Re = 0. ; Im = 0. } in for k=0 to m  1 do P := L1.(k); I := prod !wk L2.(k); Y.(k) < prod (add !P !I) {Re = 0.5 ; Im = 0. }; Y.(k + m) < prod (sous !P !I) {Re = 0.5 ; Im = 0. }; wk := prod !wk w done end; Y;; PS: i defined the type cplx by type cplx = {Re : float ; Im : float}, prod, add and sous are respectively product, addition and substraction of cplx numbers _________________________________________________________________ Windows Live Mail : découvrez et testez la version bêta ! http://www.ideas.live.com/programpage.aspx?versionId=5d21c51ab16143149b0e4911fb2b2e6d