<?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="2002/07/b7841084f82ad9e51765e3357d07ea48"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-22T09:31:44"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)"
  prev="2002/07/4802f10029290a05949a2114919ab9d6"
  next="2002/07/9ce195764ef654a5dfb7205f3c85a290"
  prev-in-thread="2002/07/133a762c6b32cf03f761f4230b1561c8"
  next-in-thread="2002/07/2b08843c2f8529ab4a5eedce49929387"
  prev-thread="2002/07/1ba7258845ed8bd9491c0456e7a05b1e"
  next-thread="2002/07/baaa01d7b8a97fafc2d4150df5a3a6fd"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/ed6e258ddd3082e1de940b5ff3b369ea"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2002-07-20T14:20:27"
  subject="[Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/16814c22c2ab33015026d759c5d6f226"
  from="Daniel de Rauglaudre &lt;daniel.de_rauglaudre@i...&gt;"
  author="Daniel de Rauglaudre"
  date="2002-07-20T18:29:15"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
</msg>
<msg 
  url="2002/07/7f6e58388b6fcd30627883ac681ff89c"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2002-07-21T00:47:37"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/133a762c6b32cf03f761f4230b1561c8"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2002-07-23T20:22:07"
  subject="Re: [Caml-list] Bigarray map &amp; set/get">
</msg>
</msg>
<msg 
  url="2002/07/b7841084f82ad9e51765e3357d07ea48"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-22T09:31:44"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/2b08843c2f8529ab4a5eedce49929387"
  from="Fernando Alegre &lt;fernando@c...&gt;"
  author="Fernando Alegre"
  date="2002-07-22T15:43:31"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
</msg>
<msg 
  url="2002/07/a769b8a76ed8b30094378a9caa9ea02b"
  from="Christophe TROESTLER &lt;Christophe.Troestler@u...&gt;"
  author="Christophe TROESTLER"
  date="2002-07-23T20:19:22"
  subject="Re: [Caml-list] Bigarray map &amp; set/get">
</msg>
<msg 
  url="2002/07/763129ca4fe6154a65c88d7da6b7959c"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-25T03:23:11"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/51745bbdd0ecdc6a7a43fccfff18d61e"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2002-07-25T09:31:22"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/051fb722e8cf6e3d6ab4210e82f4c243"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-25T18:24:30"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/24ceafe927865c0a249fe1cee8b3c7c7"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-26T21:51:12"
  subject="Re: [Caml-list] Bigarray map &amp; set/get (long)">
<msg 
  url="2002/07/579eb5dc14be1c802d8043f96c7e96d7"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-26T22:37:15"
  subject="wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
<msg 
  url="2002/07/87d4e5dfb5ea475448d2bc51ecccb90d"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-27T22:01:52"
  subject="Re: wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
<msg 
  url="2002/07/7b2c14348f27a8845ae2d4b2a9d58b49"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-26T22:48:37"
  subject="Re: wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
<msg 
  url="2002/07/5608bba0b3e126c6176446238a91af17"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-27T22:02:15"
  subject="Re: wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
<msg 
  url="2002/07/6fb5deefe427195778984eef0ee6d0ee"
  from="Chris Hecker &lt;checker@d...&gt;"
  author="Chris Hecker"
  date="2002-07-27T00:36:46"
  subject="Re: wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
<msg 
  url="2002/07/48145749fb05dbc641b08cc3c73dea0b"
  from="Dimitri Ara &lt;dimitri@n...&gt;"
  author="Dimitri Ara"
  date="2002-07-27T12:06:11"
  subject="Re: wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
</msg>
<msg 
  url="2002/07/ced8870b7d5cbdccff4a58acca97dcb0"
  from="Dimitri Ara &lt;dimitri@n...&gt;"
  author="Dimitri Ara"
  date="2002-07-27T21:59:32"
  subject="Re: wanted features (was: Re: [Caml-list] Bigarray map &amp; set/get (long))">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>
&gt; Now, if I specify the
&gt; full type of the arrays I want (here
&gt; 
&gt; type mat =
&gt;   (float, Bigarray.float64_elt, Bigarray.fortran_layout) Bigarray.Array2.t
&gt; 
&gt; ) then the code runs much faster: 0.87 sec (still more than 5 times
&gt; the C version unfortunately).  That sould be mentioned in
&gt; http://caml.inria.fr/ocaml/speed.html IMHO -- and maybe this page
&gt; could be better advertised?.

It should be mentioned, but really this is the same phenomenon as for
regular arrays: efficient array access code cannot be generated unless
the full type of the (big-) array is statically known.

&gt; * The Lacaml modules does contain some "matlab like" operations on
&gt;   vectors (and, in the future, on 2D arrays).  That will make easy to
&gt;   write fast code for this example.  However, one thing that will
&gt;   always be necessary is to make CAML functions act on arrays.

In the applications for which Bigarray was initially intended, the
Caml code that manipulates directly the bigarrays isn't
time-critical: the time-critical computations are done by external
libraries such as BLAS, Lapack, etc.  Your matrix multiplication code
is a good example: if you care about its performances, then you need
to make it a lot more sophisticated so that it will be cache-friendly
(e.g. blocking); better use an existing, well-tuned C or Fortran
implementation than try to do your own in Caml.

Put it another way, bigarrays are oriented towards efficient
communications with external libraries, not towards writing efficient
numerical code in Caml; for the latter purpose, regular arrays are
actually more efficient.

&gt; * Are bound checks responsible for the difference between the "fully
&gt;   typed" version [mac (out:mat) (a:mat) (b:mat) (c:mat)] and C??

Partially responsible, but another source of overhead is the
address computations when accessing a big array: these involve linear
formulas of the form X * dim1(a) + Y, which are not optimized inside
loops, while most C and Fortran compilers do extensive optimizations
for this kind of computations (hoisting of loop-invariant code,
transformation of multiplications into iterated additions, etc).

&gt; P.S.  Is it possible to write a "let module A = B" (i.e., module
&gt; renaming) in camlp4?

That's a standard feature of the OCaml module language; it's written
"module A = B".  What a surprise :-)

- Xavier Leroy
-------------------
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>

