<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/12/e5b28fabb22922cf3a38685086cbffc1"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2003-12-15T10:01:30"
  subject="Re: [Caml-list] Matrix libraries"
  prev="2003/12/d48b5541e82f7a6160b744399b9e7b12"
  next="2003/12/d1b02bef80190b6a892c1eb4d2c74bff"
  prev-in-thread="2003/12/0a43e811112e9d2e886447b4a4cde60d"
  next-in-thread="2003/12/45603114c54f97f2b300a8200967c2d8"
  prev-thread="2003/12/68276101f2bc192b44f47bce0bf1c103"
  next-thread="2003/12/c9409b63462d80cc0a4b0355adf1e0b0"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Matrix libraries">
<msg 
  url="2003/12/f9520b7839c36f67ec24f72b79457271"
  from="romildo@u..."
  author="romildo@u..."
  date="2003-12-13T13:51:36"
  subject="[Caml-list] Matrix libraries">
<msg 
  url="2003/12/a2033ccc51a85fa08cd9c55584643029"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2003-12-13T16:36:15"
  subject="Re: [Caml-list] Matrix libraries">
<msg 
  url="2003/12/09f10707cb7d748374f53d21860a4769"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-12-13T21:38:23"
  subject="Re: [Caml-list] Matrix libraries">
<msg 
  url="2003/12/c3b75dfeec654641ac28b231c93f7c56"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2003-12-14T15:02:00"
  subject="Re: [Caml-list] Matrix libraries">
<msg 
  url="2003/12/0a43e811112e9d2e886447b4a4cde60d"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-12-14T23:11:05"
  subject="Re: [Caml-list] Matrix libraries">
<msg 
  url="2003/12/e5b28fabb22922cf3a38685086cbffc1"
  from="Markus Mottl &lt;markus@o...&gt;"
  author="Markus Mottl"
  date="2003-12-15T10:01:30"
  subject="Re: [Caml-list] Matrix libraries">
</msg>
</msg>
</msg>
<msg 
  url="2003/12/45603114c54f97f2b300a8200967c2d8"
  from="Shivkumar Chandrasekaran &lt;shiv@e...&gt;"
  author="Shivkumar Chandrasekaran"
  date="2003-12-15T20:41:17"
  subject="[Caml-list] CamlFloat">
</msg>
<msg 
  url="2003/12/6b69eacae8908603f24d7c8496a1b944"
  from="Shivkumar Chandrasekaran &lt;shiv@e...&gt;"
  author="Shivkumar Chandrasekaran"
  date="2003-12-15T21:15:58"
  subject="Re: [Caml-list] Matrix libraries">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
On Sun, 14 Dec 2003, Oleg Trott wrote:
&gt; On Sunday 14 December 2003 10:01 am, Markus Mottl wrote:
&gt; &gt; In any case, LACAML is supposed to stay a low-level interface to
&gt; &gt; BLAS/LAPACK. 
&gt; 
&gt; The $1e6 quesion: do you want the library to be safe from user abuse, i.e.
&gt; no function input should result in corrupted memory ?

Yes, absolutely! That's why I think that checking all parameters before
passing them to LAPACK is a necessity even if it is a bit tedious
to implement considering the huge number of arguments that some
LAPACK-functions take.

&gt; Thanks for the link! CamlFloat isn't even in Google yet. It must be new. Are 
&gt; there others?

Yes, CamlFloat is fairly new. I don't know whether there are
others. Interfacing BLAS/LAPACK is not for the fainthearted: it has tons
of functions each with lots of parameters of various types so it's a
bit boring to do and very easy to make mistakes. Most people probably
don't have the patience for this.

CamlFloat definitely seems to aim at professional use so I expect that
it may become the library of choice for linear algebra, my library acting
as convenient low-level interface.

&gt; Some of this error-handling like checking that input matrices/vectors have 
&gt; compatible sizes seems tedious (and error-prone), and I think it can be 
&gt; auto-generated from parsing *.f files (including comments) But, yes, maybe 
&gt; it's too hard and not worth the effort.

By relying on as much abstraction as possible, the effort of parameter
checking can be reduced to a reasonable level. Using existing functions as
guideline, it most often shouldn't take longer than an hour to implement
and test new LAPACK-functions. Due to the macro system, this automatically
covers alls four kinds of functions (S/D/C/Z).

&gt; Each thread oviously needs its own workspace. I think this can be done using
&gt; 
&gt; (int * vec ref) list ref            (* int  = id (self ()) *)
&gt; 
&gt; association list (or hash table).  Now, "get", "resize", etc. could check if 
&gt; the thread has its workspace and return it, allocating if necessary.
&gt; 
&gt; I think there is a problem with this approach though: each thread's workspace
&gt; needs to be removed once the thread terminates. OCaml has at_exit but no 
&gt; at_thread_exit that I can find (Maybe it can be defined using 
&gt; Sys.set_signal's ?)

Well, there is always the tension between convenience and simplicity. I
think that features like this should be added in a separate layer.

&gt; &gt; I had indeed thought about this, but that would have made it more
&gt; &gt; inconvenient to people who want to keep accessing "a" directly using
&gt; &gt; the Bigarray-module and the .{}-notation. 
&gt; 
&gt; I think the inconvenience is minimal:
&gt; 
&gt; a.{...}  vs a.mat_data.{...}
&gt; 
&gt; (and it's just typing)

And what about other matrix types like band, tridiagonal, etc.? You'd need
a discriminated union for this, which requires pattern matching.  Again,
I think this should be done on a higher level - e.g. as in CamlFloat.

&gt; But it saves you from the very error-prone and boring task of having to 
&gt; remember which variables designate which dimensions ("Is it m x n or n x k, 
&gt; did I transpose that?"), etc.
&gt; 
&gt; OTOH submatrices/slices probably aren't the most frequently used features,
&gt; so I haven't made up my mind as to which is better.

Exactly. I think that libraries should attempt to optimize for the likely
cases. And a low-level library, which is mainly used by other libraries
again, should IMHO not go overboard with convenience for end users.

Regards,
Markus

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

