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 vs. array - mixing?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-04-23 (14:56)
From: Daniel Andor <da209@c...>
Subject: [Caml-list] Bigarray vs. array - mixing?
Hi All,

I've looked through the archives, but could not find any talk of this 
particular problem.

Basically I have numerical code that uses Bigarrays in some parts (for example 
in interfacing with Lacaml), but other parts that use arrays.  It doesn't 
seem to be that clean to make them co-exist.  Which should I use?

Since I was forced to use Bigarrays for Lacaml (which is a wonderful interface 
to LAPACK -- but missing some drivers. :(((  ), I decided to use Bigarrays 
for much of the rest of my program.  I made judicious use of blit and splice, 
since I assume that they only do two bounds checks. But my code still spends 
a lot of time in Bigarray.  In fact approx the *same amount of time* as it 
spends calculating! (according to gprof)

Even though Bigarrays are efficient to access from C/Fortran in LAPACK, I 
still have to set the matrices up.  And to do that I have to shuffle around 
lots if itsy bitsy matrices -- and that's what seems to be killing me.

So I don't know if I should be using arrays or Bigarrays.  They both have 
their advantages and disadvantages (arrays: fast access; Bigarrays: nice 
splicing etc, but cannot turn off bounds checking, so slow access).  

At the moment I've ended up with a mess, since my algorithm code uses arrays, 
but code that interfaces Lacaml and Gnuplot use Bigarrays.

What should I do?  It's hard to be consistent.

PS: I read "Array Optimizations in OCaml" by Michael Clarkson & Vaibhav Vaish, 
but it's no help to me at this time.  

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: