Effacer les filtres
Effacer les filtres

Efficient ways to tackle memory problems while creating a symmetric matrix

2 vues (au cours des 30 derniers jours)
Yaswanth Sai Jetti
Yaswanth Sai Jetti le 28 Mai 2020
I have written a function which gives a required symmetric matrix with real values. The input variable to the function is indicative of the size of the matrix. I am running into memory issues when this size is very large(like when n=128, for my computer), even while initializing the array itself. The code looks something like this,
function C = circcont(n)
deltan = n;
xs = (-deltan:1:deltan)';
ys = (-deltan:1:deltan)';
xlength = length(xs);
ylength = length(ys);
Cu = zeros(ylength*xlength,ylength*xlength);
%..............................
% Manipulation of the Cu matrix
%..............................
C = Cu+Cu'-diag(diag(Cu));
end
The error I am receiving is "Error using zeros Requested 66049x66049 (32.5GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive."
I know that the main constraint is my computer memory. But is there a way I can make use of the property of symmetry of the matrix to store the values and thus make an efficient usage of the memory. Thanks.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by