필터 지우기
필터 지우기

Can I make this for loop fast?

조회 수: 2 (최근 30일)
Mohammod Minhajur Rahman
Mohammod Minhajur Rahman 2018년 11월 28일
댓글: Mohammod Minhajur Rahman 2018년 11월 28일
Hi, I have a for loop that do some matrix multplicaton. Here, max i and j is 2000, U_new is a matrix of size 200 by 20, K111 cell contains 2000 full matrices of size 200 by 200.
p = 0;
for i =1:max(size(K111))
for j =1:max(size(K111))
p = p + 1;
KQQ{p} = U_new'*K111{i}*K111{j}*U_new;
end
end
  댓글 수: 2
Matt J
Matt J 2018년 11월 28일
Are the K111 matrices symmetric?
Mohammod Minhajur Rahman
Mohammod Minhajur Rahman 2018년 11월 28일
Hi Matt, Yes, the K111 matrices are symmetric

댓글을 달려면 로그인하십시오.

채택된 답변

Matt J
Matt J 2018년 11월 28일
편집: Matt J 2018년 11월 28일
Here I make occasional use of MAT2TILES (Download),
UK=cell2mat( mat2tiles( U_new'*cell2mat(K111(:).') ,[20,200]).' );
KQQ= mat2tiles( UK*UK.' ,[20,20]);
KQQ=KQQ(:);
  댓글 수: 1
Mohammod Minhajur Rahman
Mohammod Minhajur Rahman 2018년 11월 28일
Much Thanks! It works great

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by