Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: Q: Caml for number crunching and/or scripting?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-09-15 (06:38)
From: William Chesters <williamc@d...>
Subject: Re: Q: Caml for number crunching and/or scripting?
Basile Starynkevitch writes:
 > Hello All,
 > Are there anyone using CAML or Ocaml 
 > for numerical/physical/scientific applications (maybe number crunching)
 > as an embeddable scripting langage
 > (both are possible: using CAML as a scripting langage driving low
 > level -eg Fortran- numerical routines)

Yes, I use it for both actually.

I've used camlp4 (much recommended btw) to extend the syntax of ocaml
so that I can write matrix/tensor calculations using the summation

	tens v[I J] += w[I K J L] b[K L] + k a[I J]

and have a very efficient loop to do the work inserted automatically,
in C or in ML.

I keep the matrices in Fortran layout so that I can use Lapack
routines on them.  Using ocamlopt's -output-obj option you can even
squeeze in a call initialise the f2c libraries at startup time.

I've also taken to using ocaml for scripting jobs that are more
complicated than Perl can comfortably handle.  It's interesting that
ML's background as a very abstract language gives it some of the
conciseness and convenience of Perl, but without the flakiness.
On the other hand I'd rather have Perl's than emacs's regexps ...