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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id BD1BEBBBC for ; Sat, 1 Apr 2006 16:42:46 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k31EgjXZ013925 for ; Sat, 1 Apr 2006 16:42:46 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA10422 for ; Sat, 1 Apr 2006 16:42:45 +0200 (MET DST) Received: from rouge.crans.org (rouge.crans.org [138.231.136.3]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k31EgiFk013919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 1 Apr 2006 16:42:44 +0200 Received: from localhost (rouge.adm.crans.org [138.231.144.3]) by rouge.crans.org (Postfix) with ESMTP id 5C9E9BB80; Sat, 1 Apr 2006 16:42:44 +0200 (CEST) Received: from rouge.crans.org ([138.231.144.3]) by localhost (rouge [138.231.144.3]) (amavisd-new, port 10024) with LMTP id 27111-03-6; Sat, 1 Apr 2006 16:42:44 +0200 (CEST) Received: from [192.168.1.10] (ALille-151-1-30-62.w83-192.abo.wanadoo.fr [83.192.240.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rouge.crans.org (Postfix) with ESMTP id D8558BB67; Sat, 1 Apr 2006 16:42:43 +0200 (CEST) Message-ID: <442E9162.1080803@crans.org> Date: Sat, 01 Apr 2006 16:42:42 +0200 From: =?ISO-8859-1?Q?Li-Thiao-T=E9_S=E9bastien?= User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jonathan Roewen Cc: caml-list@inria.fr Subject: Re: [Caml-list] Documentation request: allocation of bigarrays in C References: <442D3667.90904@crans.org> <442E5314.9080804@crans.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at crans.org X-Miltered: at concorde with ID 442E9165.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 442E9164.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bigarrays:01 arrays:01 bigarrays:01 ocaml:01 reordering:01 higher-level:01 ocaml:01 parsing:01 bigarray:01 bigarray:01 binary:01 wrote:01 caml-list:01 functions:01 mistaken: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 Jonathan Roewen wrote: >>In my case, I want to read a relatively big file (50MB) containing >>arrays of floats . I use C functions for the raw speed then pass the >>bigarrays to OCaml to do some reordering of the data, and higher-level >>processing. >> >>I do not open the file in Ocaml then send a string to C for parsing, but >>rather open the file in C and return the bigarray list to Ocaml. (cf my >>previous mistake on creating Ocaml lists in C on this mailing-list) > > Does Bigarray.X.map_file not serve the purpose? > Not really. If I am not mistaken, map_file reads a file into a bigarray in binary mode. The file format is not as straightforward as that, I need to parse strings into floats and output a list of bigarrays embedded in a record with additional info. See the following excerpt : 1796.6221 3 1797.4133 250143 1798.0955 2401147 1799.1106 483314 1799.8252 192082 SPEC#: 2 SIZE: 140 TIME: 16.300000 MSLEVEL: 2 PRECURSOR: 531.552002 156.1387 7265 158.9650 1234 161.0317 2536 162.7167 5898 164.6776 12305 165.7509 4636 166.8494 64993 168.6152 35544 169.3650 1798 FYI, this is data from mass spectrometry experiments. Regards, -- Li-Thiao-Té Sébastien