caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ocaml for Scientific computing
@ 2007-09-25 11:01 Alex Mikhalev
  2007-09-25 11:32 ` [Caml-list] " Erik de Castro Lopo
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alex Mikhalev @ 2007-09-25 11:01 UTC (permalink / raw)
  To: caml-list

Dear all,
I am wondering is anyone using Ocaml for scientific computing? I didn't
mean parsing, but for number crunching applications, like signal/image
analysis. Is it suitable for this kind of tasks in general? I would like
to hear from someone practically using it, not just theoretical
possibility.

I have read "Ocaml for Scientists" and although it gave me some very
good ideas, I didn't manage to repeat a number of examples with modules
from this book. I had a problem compiling or using scientific modules
(lacaml, fftw, some others) on linux and macosx and since some of these
modules look like someones graduate project, I would like to hear from
people practically using ocaml for mathematical simulations or analysis.
Preferable with OS, modules, problems encountered. 

Regards,
Alex


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 11:01 Ocaml for Scientific computing Alex Mikhalev
@ 2007-09-25 11:32 ` Erik de Castro Lopo
  2007-09-25 15:22   ` Jon Harrop
  2007-09-25 16:11 ` Hezekiah M. Carty
  2007-09-26  3:06 ` Jan Kybic
  2 siblings, 1 reply; 10+ messages in thread
From: Erik de Castro Lopo @ 2007-09-25 11:32 UTC (permalink / raw)
  To: caml-list

Alex Mikhalev wrote:

> I am wondering is anyone using Ocaml for scientific computing?

Yes.

> I didn't
> mean parsing, but for number crunching applications, like signal/image
> analysis.

Yes. I'm working on code for audio digital signal processing and 
function optimisation. I also wrote my own simple computer algebra
system.

> Is it suitable for this kind of tasks in general?

Much better than C or C++ or GNU Octave.

> I have read "Ocaml for Scientists" and although it gave me some very
> good ideas, I didn't manage to repeat a number of examples with modules
> from this book. I had a problem compiling or using scientific modules
> (lacaml, fftw, some others) on linux and macosx and since some of these
> modules look like someones graduate project,

I've looked at lacaml and didn't find any particular problems. The ocaml
fftw module was a little more problematic but I resolved the problem in
the end.

 I would like to hear from
> people practically using ocaml for mathematical simulations or analysis.
> Preferable with OS, modules, problems encountered. 

I'm doing this on Ubuntu Linux, I usually use package distributed by
Ubuntu but will compile my own from source if I need to.

HTH,
Erik
-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"... the industrial-capitalist mode of software production
was doomed to be outcompeted from the moment capitalism
began to create enough of a wealth surplus for many
programmers to live in a post-scarcity gift culture."
-- Eric S. Raymond


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 11:32 ` [Caml-list] " Erik de Castro Lopo
@ 2007-09-25 15:22   ` Jon Harrop
  0 siblings, 0 replies; 10+ messages in thread
From: Jon Harrop @ 2007-09-25 15:22 UTC (permalink / raw)
  To: caml-list

On Tuesday 25 September 2007 12:32:51 Erik de Castro Lopo wrote:
> I've looked at lacaml and didn't find any particular problems. The ocaml
> fftw module was a little more problematic but I resolved the problem in
> the end.

I found Christophe's latest version fftw3 from sourceforge CVS to be easier to 
use and very capable. One feature I would like is the ability to use ordinary 
float or Complex.t arrays rather than big arrays. I'd also like better 
integrated support for complex numbers in OCaml...

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 11:01 Ocaml for Scientific computing Alex Mikhalev
  2007-09-25 11:32 ` [Caml-list] " Erik de Castro Lopo
@ 2007-09-25 16:11 ` Hezekiah M. Carty
  2007-09-25 16:23   ` Jon Harrop
  2007-09-26  3:06 ` Jan Kybic
  2 siblings, 1 reply; 10+ messages in thread
From: Hezekiah M. Carty @ 2007-09-25 16:11 UTC (permalink / raw)
  To: caml-list

On Tue, 25 Sep 2007, Alex Mikhalev wrote:

> Dear all,
> I am wondering is anyone using Ocaml for scientific computing? I didn't
> mean parsing, but for number crunching applications, like signal/image
> analysis. Is it suitable for this kind of tasks in general? I would like
> to hear from someone practically using it, not just theoretical
> possibility.
> 
> I have read "Ocaml for Scientists" and although it gave me some very
> good ideas, I didn't manage to repeat a number of examples with modules
> from this book. I had a problem compiling or using scientific modules
> (lacaml, fftw, some others) on linux and macosx and since some of these
> modules look like someones graduate project, I would like to hear from
> people practically using ocaml for mathematical simulations or analysis.
> Preferable with OS, modules, problems encountered. 

I am using OCaml for atmospheric/meteorological research.  I started
using it about a year ago, and feel that it has been the right tool
for the job.  My work so far has involved manipulating and analyzing
satellite data sets.  OCaml has been quite fast computationally, and
the strict type checking and type inference have helped to eliminate
several sources of error.

I've used the OCaml GSL bindings and toyed around with some of the
plotting modules available (gnuplot, mlgrace, OVT, plplot,
camlimages, the included Graphics module).  The code has been used
and developed under Ubuntu, Debian and CentOS.  I currently use Godi
for my OCaml installation because it makes it easier to keep things
in my home directory if I don't have root access to a system.

The biggest problem I've faced with OCaml has been missing
libraries.  The data I'm working with is (almost) all in HDF format,
so I had to write my own library bindings for OCaml.  The other is
a library for plotting data - but that is largely due to a lack of
time spent on my part.  That said, I've found writing bindings to C
libraries in OCaml much nicer than other languages I've tried.

An example of an older number crunching/scientific tool using OCaml
is Psilab - http://psilab.sourceforge.net/
However, it does not seem to be maintained by its author any more.
I have updated the code slightly so that it builds with newer GCC
versions if you have any interest in that.

Good luck with your work!  I highly recommend OCaml, both for
selfish reasons - to bring more number-crunching oriented users in
to the community - and because it is an excellent tool for the job.

Hez


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 16:11 ` Hezekiah M. Carty
@ 2007-09-25 16:23   ` Jon Harrop
  2007-09-25 17:01     ` Markus E L
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Harrop @ 2007-09-25 16:23 UTC (permalink / raw)
  To: caml-list

On Tuesday 25 September 2007 17:11:31 Hezekiah M. Carty wrote:
> The biggest problem I've faced with OCaml has been missing
> libraries.  The data I'm working with is (almost) all in HDF format,
> so I had to write my own library bindings for OCaml.  The other is
> a library for plotting data...

While this is a general purpose graphics library rather than a plotting 
library, you may be interested in our hardware-accelerated vector graphics 
library Smoke:

  http://www.ffconsultancy.com/products/smoke_vector_graphics/?ol

Smoke makes it much easier to write visualization software.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 16:23   ` Jon Harrop
@ 2007-09-25 17:01     ` Markus E L
  2007-09-25 17:03       ` Jon Harrop
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Markus E L @ 2007-09-25 17:01 UTC (permalink / raw)
  To: caml-list


Jon Harrop wrote:

> On Tuesday 25 September 2007 17:11:31 Hezekiah M. Carty wrote:
>> The biggest problem I've faced with OCaml has been missing
>> libraries.  The data I'm working with is (almost) all in HDF format,
>> so I had to write my own library bindings for OCaml.  The other is
>> a library for plotting data...
>
> While this is a general purpose graphics library rather than a plotting 
> library, you may be interested in our hardware-accelerated vector graphics 
> library Smoke:
>
>   http://www.ffconsultancy.com/products/smoke_vector_graphics/?ol
>
> Smoke makes it much easier to write visualization software.


Nothing against Smoke, but on a Unix/Linux platform it might just be
useful to use Ocaml to calculate the graphics data and pipe that to
another process, e.g. one of the well known scientific visualization /
graphing packages (starting with gnuplot, but there have been others
too). For practical work (not advertising), that spares one to do all
that tricky stuff like placing labels or ticks on the axis yourself.

BTW: What I'd consider a boon for scientific visualization, actually,
would be to output SVG to a file. Such an SVG file could be annotated
with a usual graphics editor like inkscape for publication: Very
valuable (if you don't need interactive visualization).

Regards -- Markus


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 17:01     ` Markus E L
@ 2007-09-25 17:03       ` Jon Harrop
  2007-09-25 17:35       ` Hezekiah M. Carty
  2007-09-26 18:53       ` Vu Ngoc San
  2 siblings, 0 replies; 10+ messages in thread
From: Jon Harrop @ 2007-09-25 17:03 UTC (permalink / raw)
  To: caml-list

On Tuesday 25 September 2007 18:01:57 Markus E L wrote:
> BTW: What I'd consider a boon for scientific visualization, actually,
> would be to output SVG to a file. Such an SVG file could be annotated
> with a usual graphics editor like inkscape for publication: Very
> valuable (if you don't need interactive visualization).

Absolutely. The full version of Smoke actually already does this but the free 
version does not.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 17:01     ` Markus E L
  2007-09-25 17:03       ` Jon Harrop
@ 2007-09-25 17:35       ` Hezekiah M. Carty
  2007-09-26 18:53       ` Vu Ngoc San
  2 siblings, 0 replies; 10+ messages in thread
From: Hezekiah M. Carty @ 2007-09-25 17:35 UTC (permalink / raw)
  To: caml-list

On Tue, 25 Sep 2007, Markus E L wrote:

> BTW: What I'd consider a boon for scientific visualization, actually,
> would be to output SVG to a file. Such an SVG file could be annotated
> with a usual graphics editor like inkscape for publication: Very
> valuable (if you don't need interactive visualization).

This is one of the things about the OCaml Visualization Toolkit
(one of the Jane St. summer projects).  It is built around
cairo-ocaml, which in turn supports SVG output.

OVT is still somewhat incomplete, but its output is already quite
attractive thanks to the Cairo backend.  SVG output is one of the
items still missing from OVT, and I do not know what plans exist to
maintain this library.  But with that addition it would be an
immensely useful tool for scientific plots, among other things.
I've already used OVT for a few simple presentation figures.

Hez


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Ocaml for Scientific computing
  2007-09-25 11:01 Ocaml for Scientific computing Alex Mikhalev
  2007-09-25 11:32 ` [Caml-list] " Erik de Castro Lopo
  2007-09-25 16:11 ` Hezekiah M. Carty
@ 2007-09-26  3:06 ` Jan Kybic
  2 siblings, 0 replies; 10+ messages in thread
From: Jan Kybic @ 2007-09-26  3:06 UTC (permalink / raw)
  To: Alex Mikhalev; +Cc: caml-list

> I am wondering is anyone using Ocaml for scientific computing? I didn't
> mean parsing, but for number crunching applications, like signal/image
> analysis. Is it suitable for this kind of tasks in general? I would like
> to hear from someone practically using it, not just theoretical
> possibility.

I have used Ocaml for several projects involving numerical
calculations, including image processing, boundary element methods and
optimization. I use Lacaml, fftw, MPI and Gsl libraries, the
installation was not difficult.  Ocaml has performed very well for me 
so far, it is faster than Python or Matlab and more "friendly" than
C/C++. Some minor issues:

- There is too many different representations of vectors and matrices:
  float arrays, plain big arrays, Lacaml Fortran style big arrays,
  several kinds of Gsl vectors with yet separate styles. I found I
  often had to convert vectors or matrices from one format to another
  because the function I wanted to use was available for a different
  interface. 

- Limited interactivity - it would help if you could call native compiled
  modules from the toplevel.

- Limited debugging - it is not possible to debug compiled modules.
  I would like to see an interface to gdb (I work on Linux), or a
  possibility for the byte compiled code being debugged to call
  natively compiled modules.

- I still find Ocaml object system less natural for me and more
  limiting than for example Python's. Also, often you can do the same
  thing with the objects as with the module system, so the choice of the
  best design pattern is sometimes not obvious at the first sight and
  requires a lot of foresight. But I assume this is just a matter of
  practice.

Good luck,

Jan

-- 
-------------------------------------------------------------------------
Jan Kybic <kybic@fel.cvut.cz>                       tel. +420 2 2435 5721
http://cmp.felk.cvut.cz/~kybic                      ICQ 200569450


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Caml-list] Ocaml for Scientific computing
  2007-09-25 17:01     ` Markus E L
  2007-09-25 17:03       ` Jon Harrop
  2007-09-25 17:35       ` Hezekiah M. Carty
@ 2007-09-26 18:53       ` Vu Ngoc San
  2 siblings, 0 replies; 10+ messages in thread
From: Vu Ngoc San @ 2007-09-26 18:53 UTC (permalink / raw)
  Cc: caml-list

Markus E L a écrit :

> 
> BTW: What I'd consider a boon for scientific visualization, actually,
> would be to output SVG to a file. Such an SVG file could be annotated
> with a usual graphics editor like inkscape for publication: Very
> valuable (if you don't need interactive visualization).
> 
> Regards -- Markus

That's good to hear this. This is exactly what I do for my research 
(except that I use xfig). That's why I have written a small ocaml 
library which does this (oplot). Then svg is simple te achieve because 
there already exists a fig2svg translator. This definitely will be 
included in the next version of oplot, whenever I have some time...

San


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-09-26 18:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-25 11:01 Ocaml for Scientific computing Alex Mikhalev
2007-09-25 11:32 ` [Caml-list] " Erik de Castro Lopo
2007-09-25 15:22   ` Jon Harrop
2007-09-25 16:11 ` Hezekiah M. Carty
2007-09-25 16:23   ` Jon Harrop
2007-09-25 17:01     ` Markus E L
2007-09-25 17:03       ` Jon Harrop
2007-09-25 17:35       ` Hezekiah M. Carty
2007-09-26 18:53       ` Vu Ngoc San
2007-09-26  3:06 ` Jan Kybic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).