MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why is importing the table into Mathematica so slow???

  • To: mathgroup at smc.vnet.net
  • Subject: [mg37877] Re: [mg37864] Why is importing the table into Mathematica so slow???
  • From: "Johannes Ludsteck" <johannes.ludsteck at wiwi.uni-regensburg.de>
  • Date: Sat, 16 Nov 2002 01:15:45 -0500 (EST)
  • Organization: Universitaet Regensburg
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Jia,
the Import function of Mathematica is very slow. If 
all entries in your Matrix have the same type, you can 
use ReadList["file",Table[Number,{750}]]. This is may 
be hundred times faster.
If your entries have different types, use
ReadList["file",Table[Word,{750}]].
Then all entries are read as strings. You can convert 
the Strings containing numbers then with ToExpression.
Applying ToExpression for the non-numeric rows or
colums will also be much faster (probably by a factor 
of 100).

Best regards
	Johannes


On 15 Nov 2002 at 1:36, Jia Guo wrote:

> Hi,
> 
> I currently have such a problem in Mathematica: 
> 
> I have a matrix of size 750*750. It is in a file and I will import the
> file to Mathematica using the command: g = Import ["matrix.dat",
> "Table"].
> 
> However, it took me over 2 hours to import and display the numbers in
> the notebook. But the transpose and reverse operations to the matrix
> are really fast: 4-5 seconds. I translated the matrix into a graph and
> when I was going to export it, the same problem happened. It slowed
> down again.
> 
> Does anybody know what should I do to avoid the big overhead?
> 
> Thank you!
> 
> Jia
> 


<><><><><><><><><><><><>
Johannes Ludsteck
Economics Department
University of Regensburg
Universitaetsstrasse 31
93053 Regensburg
Phone +49/0941/943-2741



  • Prev by Date: Re: Question about calculating time and 3-D visualization
  • Next by Date: Re: FullSimplify and FunctionExpand
  • Previous by thread: Re: Why is importing the table into Mathematica so slow???
  • Next by thread: Manipulation to Avoid Ungly -(-1+w)/x....