From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4E060BB84 for ; Fri, 19 May 2006 14:08:20 +0200 (CEST) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k4JC8Ibb030948 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 19 May 2006 14:08:20 +0200 Received: from [80.229.56.224] (helo=chetara) by pih-relay06.plus.net with esmtp (Exim) id 1Fh3mD-0006Zg-Kz for caml-list@yquem.inria.fr; Fri, 19 May 2006 13:08:17 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Array 4 MB size limit Date: Fri, 19 May 2006 13:15:32 +0100 User-Agent: KMail/1.9.1 References: <20060515141230.ajyupn2z28k0484s@horde.akalin.cx> <446986DF.1070308@inria.fr> <446D5E4A.8060005@akalin.cx> In-Reply-To: <446D5E4A.8060005@akalin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200605191315.33165.jon@ffconsultancy.com> X-Miltered: at nez-perce with ID 446DB532.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bigarrays:01 vectors:01 arrays:01 arrays:01 assertion:01 surprising:01 vectors:01 reuse:01 triangles:01 scalable:01 ocaml:01 2006:98 frog:98 wrote:01 polymorphic:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Friday 19 May 2006 06:57, Frederick Akalin wrote: > I see. This is a perfectly reasonable explanation. I ended up just > using Bigarrays of floats for now and converting from those to 3-d > vectors on demand (what I need), but it would be nice to have a type > that wraps around Array that can get around the 4M limit (using an array > of arrays like someone suggested earlier). It's sad, but I think 32-bit > is going to be around for a while, and surely I can't be the only person > to run up against this. :) Not that I mind writing such a library and > releasing it. I wonder if the Extlib guys would be interested... If you want your code to be memory efficient then using 32-bit floats via big arrays would seem like a good idea. If you want your code to be fast then you'll want a monomorphic data structure to avoid the overhead of polymorphic function calls (which is often very significant on simple, numerical container types). > > A better idea would be to determine exactly what data structure you need: > > which abstract operations, what performance requirements, etc. C++ > > and Lisp programmers tend to encode everything as arrays or lists, > > respectively, but quite often these are not the best data structure > > for the application of interest. > > I find your assertion surprising. C++ and Common LISP are by no means > lacking in standard data structures (and using bare arrays is > discouraged in C++, as far as I know) and in my experience I haven't > much seen C++ code that used arrays/vectors when not appropriate. Yes, I would say that C and Fortran programmers overuse arrays because other data structures are prohibitively difficult to implement and reuse. > In any case, in my application (a raytracer) I am reading in lists of > numbers from a file representing the points of a mesh and the triangles > that make up the mesh (represented by a list of indices into the mesh > list). A dynamically resizable, reasonable scalable array seems like > the best data structure to use. Why not use a list and then apply Array.of_list? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists