Can I make this for loop fast?

4 ビュー (過去 30 日間)
Mohammod Minhajur Rahman
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 Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by