English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Not Rocket Science
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-03-02 (23:21)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] Not Rocket Science
On Sun, Mar 2, 2008 at 5:41 AM, Jon Harrop <jon@ffconsultancy.com> wrote:
>  However, I would like to stress that these are trivial changes. For
>  example, my random matrix eigenvalue demo required only three tiny changes
>  to bring it up to date with respect to the latest Lacaml library.
>  Specifically, this:
>   open Lacaml.S
>   ...
>   let m = Mat.of_array m in
>   ignore (geev m);
>  becomes:
>   let m = Lacaml.Mat4_S.of_array m in
>   ignore (Lacaml.Impl.S.geev m);

The idiomatic way of implementing this now would be to open the
library as follows:

  open Lacaml.Impl.S

Then you can refer to the matrix module as "Mat" as usual, and you can
call all Lapack/Blas functions directly (also as usual).  The reason
for this change was the need to pack all Lacaml modules into their own
namespace.  At the time when Lacaml started out there was no packing
feature for libraries.  This change was reflected in the README.

Note that just by changing "S" to "D" when opening the library, you
can automatically switch your code from single to double precision
without having to change anything else.


Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com