Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Large SparseArray in Mathematica 9 and the predictive interface
Replies: 3   Last Post: Jan 2, 2013 9:14 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
jmmv73@gmail.com

Posts: 4
Registered: 12/30/12
Large SparseArray in Mathematica 9 and the predictive interface
Posted: Dec 30, 2012 8:49 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi there,

I was generating a banded sparse array with the following code
in the new Mathematica 9.0:

gmat[K_, l_, m_] :=
Module[{bandU, bandL, bandD, res},

bandU = Table[l, {K - 1}];
bandL = Table[m, {K - 1}];
bandD = Table[-l - m, {K}];
bandD[[1]] = -l;
bandD[[K]] = -m;

res = DiagonalMatrix[SparseArray[bandU], 1]
+ DiagonalMatrix[SparseArray[bandD]]
+ DiagonalMatrix[SparseArray[bandL], -1];

Return[res];
];


then I used the function with the following parameters (without semicolon):


gmat[100, 0.8, 1]


...and everything was ok! a 100x100 sparse matrix was created and the
"predictive interface bar" appeared.

Nevertheless, when I typed (without semicolon):


gmat[10000, 0.8, 1]


...everything went not so good, a 10000x10000 sparse matrix was created
(what was ok), but the kernel went nuts with the memory use, some gigabytes
for a small sparsearray (You can try with greater parameters, but starting
with K=5000 things go weird)

I think the problem has to do with the "predictive interface" that tries to
generate the normal form of the matrix, so it uses a lot of memory (and even
produces a kernel crash).

Has anyone had the same problem with SparseArray? or have any
explanation to what actually happens? or it is just me?

Many thanks in advance for any help or advice with this issue.

Regards,

Jose M. Martinez
Ph.D. Student
Department of Electronic Engineering
Universidad Tecnica Federico Santa Maria
Valparaiso, Chile





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.