From: "otlore dolire" <otlore@hotmail.fr>
To: caml-list@yquem.inria.fr
Subject: building fft
Date: Fri, 02 Jun 2006 13:07:27 +0200 [thread overview]
Message-ID: <BAY120-F33C38166F555F34B6240A1B5910@phx.gbl> (raw)
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=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
next reply other threads:[~2006-06-02 11:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-02 11:07 otlore dolire [this message]
2006-06-02 11:21 ` [Caml-list] " Jonathan Roewen
2006-06-02 15:32 ` Shawn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BAY120-F33C38166F555F34B6240A1B5910@phx.gbl \
--to=otlore@hotmail.fr \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox