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
[Caml-list] Bigarray map & set/get (long)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-21 (00:47)
From: Oleg <oleg_inconnu@m...>
Subject: Re: [Caml-list] Bigarray map & set/get (long)
On Friday 19 July 2002 09:59 am, Christophe TROESTLER wrote:
> let mac out a b c =
>   for i = 1 to Array2.dim1 a do
>     for j = 1 to Array2.dim2 a do
>       out.{i,j} <- a.{i,j} +. b.{i,j} *. c.{i,j}
>     done
>   done;
>   out


If you are using fortran layout (column-major) why are you incrementing rows 
in the inner-most loop? (AFAICR this can make a big difference with GCC, 
perhaps O'Caml too). Also, each loop seems to contain a call to function 
Array2.dim2. Can't this number be cached? Thirdly, does bigarray access check 
bounds? Can this be turned off? And finally, you might try to experiment with 
0-based indexing [1], it may turn out to be faster.

Let me/us know how this turns out,

[1] I absolutely abhor 0-based indexing in most modern languages
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: