Filter löschen
Filter löschen

How can I pre allocate the memory of a huge highly sparse data.

1 Ansicht (letzte 30 Tage)
Metin Ertas
Metin Ertas am 25 Feb. 2014
Hello all,
Sid=sparse(2.500.000,250.000);
for t=1:11
for i=1:250.000
Sid(ind((i,t)),i)=leng(i,t);
end
Sis(t).f={Sid};
end
The problem I have is to find a way to pre-allocate the memory for my use. Let me briefly explain the code I use and some important things .
"Sid" sparse matrix consists of 250.000(from 1 to 250.000) elements which contains not more than 500 non-zero elements out of 2.500.000!
"Sid" sparse matrix changes 11 times and all of these data needs to be stored to be used in the next part of the program.
leng which is stored as cell array contains the values of non zero elements.
ind which is also stored as cell array contains the pixel location of the related "leng"
ind(i,t) and leng(i,t) are vectors with an element of less than 500.
The problems are as you already guessed the memory and the computational cost of the code. It runs over a day and is still running. I know that preallocating the Sid matrix is impossible and matlab works much faster when the variable is pre assigned but this is what I have.
Any help to speed it up?
Sorry for keeping the questions and details so long.
Thanks

Antworten (0)

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by