필터 지우기
필터 지우기

Extract data from sparse matrix in a parfor loop

조회 수: 3 (최근 30일)
d
d 2017년 5월 29일
Hi, I need to find eigenvectors and eigenvalues for a lot of 100*100 tri-diagonal matrices. they defined as follow:
A_kk = a_n ; % main diagonal (a_n is some vector)
A_kk_below = b_n*f; %below main diagonal (b_n is some vector, and f is a number which differ at each matrix)
A_kk_above = c_n*f; %above main diagonal (c_n is some vector, and f is a number which differ at each matrix)
I'm looking for a fast way to do it so my strategy was to define a large large tridiagonal sparse matrix. Then inside a parfor loop to take part of the sparse matrix and calculate its eigenvectors/values
N=100;
Len_f=100;
a_ln_t=zeros(N,N,Len_f);
parfor i=1:Len_f
A_f = full(A((i-1)*N+(1:N),(i-1)*N+(1:N))); % take part of the sparse matrix A
[EigV,Eig] = eig(A_f,'vector'); % find eigenvectors/values
[Eig,iEig] = sort(Eig); % sort eigenvalues
EigV = EigV(:,iEig); % sort eigenvectors
Eig_f(:,:,i) = EigV; % save results in variable
end
But the problem is that I get a warning when trying to take part of the sparse matrix.
"The entire array or structure "A" is a broadcast variable. This might result in unnecessary communication overhead"
Is there any suggestions on how to avoid this warning and improve this code and perhaps make it faster?
Any input on this matter would be highly appreciated

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by