MathGroup Archive 2006

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

Search the Archive

Memory problem when multiplying large sparse matrices...

  • To: mathgroup at
  • Subject: [mg70712] Memory problem when multiplying large sparse matrices...
  • From: renormalize at
  • Date: Tue, 24 Oct 2006 02:24:16 -0400 (EDT)

I encounter a frustrating memory problem when using Mathematica 5.2 to
multiply one large sparse matrix by another diagonal one:

In[1]: = $HistoryLength=0;

In[2]: = bigmat = Import[ "C:\Documents and Settings/",

Out[2] = SparseArray[<48356957>, {38743, 76936}]

In[3]: = diagmat = Import["C:\Documents and Settings/",

Out[3] = SparseArray[<38743>, {38743, 38743}]

In[4]: = {ByteCount[bigmat], ByteCount[diagmat], MemoryInUse[ ],
MaxMemoryUsed[ ]}

Out[4] = {387011004, 1085152, 391366120, 391528736}

In[5]: = prodmat = diagmat . bigmat

>From In[5] :=

No more memory available.
Mathematica kernel has shut down.
Try quitting other applications and then retry.

The out-of-memory message appears almost immediately upon executing
In[5].  Now, my Windows XP machine has 4 GB of RAM, and since I don't
have the \3GB switch set, I assume that Mathematica can access only 2
GB.  But 2 GB seems like more than enough memory for this problem.
After all, bigmat occupies 387 MB, and the resulting prodmat should
require only another 387 MB.  So what is it about performing the matrix
dot product in In[5] that instantly balloons memory beyond the 2 GB


  • Prev by Date: Re: Re: how about fixing the Messages command?
  • Next by Date: RE: Re: Using "=" vs ":=" [Thanks!]
  • Previous by thread: Re: Solve with dot products
  • Next by thread: Re: Memory problem when multiplying large sparse matrices...