From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA17518; Mon, 11 Feb 2002 11:08:09 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA17082 for ; Mon, 11 Feb 2002 11:08:08 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g1BA84n02589; Mon, 11 Feb 2002 11:08:04 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA17532; Mon, 11 Feb 2002 11:08:03 +0100 (MET) Date: Mon, 11 Feb 2002 11:08:03 +0100 From: Xavier Leroy To: shiv@mac.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Complex stuff Message-ID: <20020211110803.A17368@pauillac.inria.fr> References: <123971FA-046C-11D6-9430-003065BDAA76@mac.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <123971FA-046C-11D6-9430-003065BDAA76@mac.com>; from shiv@mac.com on Tue, Jan 08, 2002 at 11:15:26AM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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