From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA07750; Wed, 23 Apr 2003 16:56:38 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA07978 for ; Wed, 23 Apr 2003 16:56:37 +0200 (MET DST) Received: from green.csi.cam.ac.uk (green.csi.cam.ac.uk [131.111.8.57]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h3NEuaT13679 for ; Wed, 23 Apr 2003 16:56:36 +0200 (MET DST) Received: from tcmpnb3.phy.private.cam.ac.uk ([172.24.25.7]) by green.csi.cam.ac.uk with esmtp (Exim 4.12) id 198Lfo-0001Al-00 for caml-list@inria.fr; Wed, 23 Apr 2003 15:56:36 +0100 From: Daniel Andor Reply-To: Daniel Andor To: caml-list@inria.fr Date: Wed, 23 Apr 2003 15:56:20 +0100 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Disposition: inline Subject: [Caml-list] Bigarray vs. array - mixing? Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <200304231556.20335.da209@cam.ac.uk> X-Spam: no; 0.00; bigarrays:01 interfacing:01 lacaml:01 co-exist:01 lapack:01 judicious:01 blit:01 gnuplot:01 arrays:01 bigarray:01 ocaml:01 interfaces:01 checking:01 bounds:03 algorithm:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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. Daniel. 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 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