Re: Out of memory.
- To: mathgroup at smc.vnet.net
- Subject: [mg89251] Re: Out of memory.
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Sun, 1 Jun 2008 16:33:09 -0400 (EDT)
- References: <firstname.lastname@example.org>
Richard Bowles wrote:
> I am rather new to mathematica so it is likely that I am doing some
> rather naive things.
> I have m1X20 matrix with matrix elements m1_ij=Cij P^lij S^nij.
> nij and lij are real numbers. Cij =1 or 0.
> I take the power matrix of m1^N
> m2 = MatrixPower[m1, N]
> Then need o extract the exponents of P and S and the coefficients of
> each of the terms in the resulting polynomial and write them to file.
> I do the following:
> For[i = 0, i < 20, i++;
> For[j = 0, j < 20, j++;
> eepol = Expand[m2[[i, j]]];
> k = Length[eepol];
> For[i1 = 0, i1 < k, i1++;
> w0[l_, n_] = Part[eepol, i1];
> x1 = Exponent[w0[l, n], l];
> x2 = Exponent[w0[l, n], n];
> x3 = Coefficient[ w0[l, n], l^x1*n^x2];
> dn = x2*0.25*Pi/(1.95*x1);
> Write[s1, x3];
> Write[s, dn];
> This works slowly, but fine when N=10 but I run out of memory on a
> 128GB machine when N. I plotted the memory use as a function of
> cycles through the inner loop and find that it grows linearly which
> might account for the out of memory since there are a large number of
> If anyone can suggest a faster and more memory efficient method it
> would be much appreciated.
It is not totally clear to me if your matrix contains terms which are
algebraic expressions, or just numbers. I think you are talking about a
matrix containing algebraic expressions, in which case the size of those
expressions will rise rather fast as you do MatrixPower, so the memory
limit may be genuine. Symbolic expressions soak up a lot of memory and
CPU power as compared with numerical values, and they typically double
in size each time they are combined in some way (added or multiplied, say).
My first suggestion would be to post a complete example (as simple as
possible) so that we can play with it.
Secondly it is extremely important to ensure that Mathematica can
actually use all your 128 GB (a very large figure - are you sure you are
right?) Assuming you are using Windows, make sure you have the 64-bit
version of the OS loaded. Also, if Mathematica were installed before the
change of OS, I would remove it and re-install (I am not certain if this
step is necessary, but my guess is that it would be).
Prev by Date:
Re: Wolfram Mathematica 6.0 B-splines
Next by Date:
Re: Mathematica Question
Previous by thread:
Out of memory.
Next by thread:
Re: Re: Out of memory.