Re: Efficient way of reading matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg85291] Re: Efficient way of reading matrices
- From: "Szabolcs HorvÃt" <szhorvat at gmail.com>
- Date: Tue, 5 Feb 2008 06:09:22 -0500 (EST)
- References: <fo3gad$b3p$1@smc.vnet.net>
In Feb 5, 2008 7:22 AM, <m.r at inbox.ru> wrote: > > Hi Szabolcs, > > maybe you can read and pack your matrix row by row: > > WriteString["/zzz", Sequence @@ Riffle[#, " "], "\n"]& /@ > RandomInteger[{-1000, 1000}, {200, 250000}] > Close["/zzz"] > (*a test file*) > > (m = Developer`ToPackedArray@ Read["/zzz", > Array[Number&, 250000]]& /@ Range[200];) // Timing > Close["/zzz"] > Thanks you Maxim Rytin, Good and useful suggestion, as always. :-) I have already written a MathLink matrix reader program to do the work, but your program (though slower) uses even less memory as it never needs to store two copies of the complete matrix in memory. Szabolcs Horvát