Out of memory.

• To: mathgroup at smc.vnet.net
• Subject: [mg89237] Out of memory.
• From: Richard Bowles <watsonhb at arczip.com>
• Date: Sun, 1 Jun 2008 03:34:46 -0400 (EDT)

```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
terms.

If anyone can suggest a faster and more memory efficient method it
would be much appreciated.

Cheers
Richard

```

• Prev by Date: Re: Mathematica 6: How to plot multiple lists with error bars?
• Next by Date: Re: Mathematica 6: No more memory available problem with ListDensityPlot
• Previous by thread: Re: NDSolve with arrays
• Next by thread: Re: Out of memory.