Packed array and ReadList
- To: mathgroup at smc.vnet.net
- Subject: [mg41497] Packed array and ReadList
- From: "Bruyndonckx P." <pbruynd at vub.ac.be>
- Date: Thu, 22 May 2003 06:58:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I have a very large text file with real numbers. I would like to read this numbers and store them in a packed array. My computer has sufficient memory to store all numbers in a packed array form. However, when I try something like ToPackedArray[Readlist[filename,Real]], Mathematica uses much more memory during the process. Hence I assume the numbers are first stored in a normal list and the packed. Is there a way to read a file of numbers directly into a packed array ? Since I am specifying that file file just contains numbers, I expected that Mathematica (4.2) would store the result of the ReadList commando in a packed array without me telling it to do so. But it doesn't (PackedArrayQ gives false) and I have to add the ToPackedArray commando myself. Peter