From: "Jonathan Roewen" <jonathan.roewen@gmail.com>
To: "otlore dolire" <otlore@hotmail.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] building fft
Date: Fri, 2 Jun 2006 23:21:25 +1200 [thread overview]
Message-ID: <ad8cfe7e0606020421v572d6d9fj5355e3b41a0f5ef6@mail.gmail.com> (raw)
In-Reply-To: <BAY120-F33C38166F555F34B6240A1B5910@phx.gbl>
variables have to start with a lowercase letter. values starting with
uppercase are module names/type constructors.
On 6/2/06, otlore dolire <otlore@hotmail.fr> wrote:
> 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
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
next prev parent reply other threads:[~2006-06-02 11:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-02 11:07 otlore dolire
2006-06-02 11:21 ` Jonathan Roewen [this message]
2006-06-02 15:32 ` [Caml-list] " 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=ad8cfe7e0606020421v572d6d9fj5355e3b41a0f5ef6@mail.gmail.com \
--to=jonathan.roewen@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=otlore@hotmail.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