フィルターのクリア

Efficient ways to tackle memory problems while creating a symmetric matrix

2 ビュー (過去 30 日間)
Yaswanth Sai Jetti
Yaswanth Sai Jetti 2020 年 5 月 28 日
編集済み: Yaswanth Sai Jetti 2020 年 5 月 28 日
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.

回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by