* [Caml-list] Complex stuff
@ 2002-01-08 19:15 shiv
2002-02-11 10:08 ` Xavier Leroy
0 siblings, 1 reply; 2+ messages in thread
From: shiv @ 2002-01-08 19:15 UTC (permalink / raw)
To: caml-list
Sorry to bring this up again ...
I know that the Ocaml team might be implementing complex numbers in
Ocaml.
However, I need complex support now and I was wondering what the best
way to proceed would be, if I want to port the code over to the native
complex support as and when it becomes available?
I need the basic arithmetic and trignometric operations and bigarray
(complex32, complex64 and fortran layout) support.
I could borrow the basic arithmetic and trignometric stuff from Psilab
or even Clean libraries. Should I represent complex numbers as tuples or
record (tuples I guess, since that is what Psilab does)?
What about the bigarray support? The basic stuff I can roll on my own,
unless somebody else has already done it and can provide me with code.
How about the bracket notation? Do I need to use camlp4 to get a.{i,j}
to return a complex number and a.{i,j} <- to store a complex number in
(i,j)th position (etc..)?
The reason I need the a.{i,j} notation is that I already have real
number versions of my code and the complex versions will be identical.
However, for performance reasons I cannot use functors. So I intend to
do cut-and-paste!
Any advice and/or code will be appreciated.
Thanks,
--shiv--
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Caml-list] Complex stuff
2002-01-08 19:15 [Caml-list] Complex stuff shiv
@ 2002-02-11 10:08 ` Xavier Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 2002-02-11 10:08 UTC (permalink / raw)
To: shiv; +Cc: caml-list
> I know that the Ocaml team might be implementing complex numbers in
> Ocaml.
I've just completed a first implementation. You can see what it looks
like from our anonymous CVS repository camlcvs.inria.fr.
> However, I need complex support now and I was wondering what the best
> way to proceed would be, if I want to port the code over to the native
> complex support as and when it becomes available?
>
> I need the basic arithmetic and trignometric operations and bigarray
> (complex32, complex64 and fortran layout) support.
Done in the working sources.
> I could borrow the basic arithmetic and trignometric stuff from Psilab
> or even Clean libraries. Should I represent complex numbers as tuples or
> record (tuples I guess, since that is what Psilab does)?
I chose to use a record type {re:float; im:float} because this leads
to a more efficient memory layout than a pair of float.
> What about the bigarray support? The basic stuff I can roll on my own,
> unless somebody else has already done it and can provide me with code.
> How about the bracket notation? Do I need to use camlp4 to get a.{i,j}
> to return a complex number and a.{i,j} <- to store a complex number in
> (i,j)th position (etc..)?
The a.{i,j} notation is supported for complex types.
By the way, if there are numerically competent folks on this list,
please have a look at
http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/ocaml/stdlib/complex.ml
and let me know if the implementation of complex arithmetic is (1)
mathematically correct, and (2) numerically reasonable. I tried to
guard against overflows and underflows in intermediate results, but
could use some help here. Please reply to me directly -- no need to
split machine epsilons and count ulp's on this list.
- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-02-11 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-08 19:15 [Caml-list] Complex stuff shiv
2002-02-11 10:08 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox