Browse thread
[Caml-list] Bigarray map & set/get (long)
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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
Chris,
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.
HTH
Let me/us know how this turns out,
Oleg
[1] I absolutely abhor 0-based indexing in most modern languages
-------------------
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