summation of products of matrices

2 ビュー (過去 30 日間)
Pasquale Valentini
Pasquale Valentini 2022 年 11 月 4 日
コメント済み: Daniel Neubauer 2022 年 11 月 7 日
I would like so have a fast solution to this problem
where is an p x m matrices and S is a symmetric matrices p x p, where m and p are very large

回答 (1 件)

Daniel Neubauer
Daniel Neubauer 2022 年 11 月 4 日
編集済み: Daniel Neubauer 2022 年 11 月 4 日
take a look at
is that what you need?
p=3;
m=4;
i=5;
E=ones(p,p,i);
A=rand(p,m,i);
Sum=sum(pagemtimes(pagemtimes(A,'C',E,'N'),A),3)
Sum = 4×4
16.1794 14.6014 11.9153 11.5921 14.6014 14.7036 11.2311 10.9738 11.9153 11.2311 9.4835 8.7488 11.5921 10.9738 8.7488 9.6928
  4 件のコメント
Pasquale Valentini
Pasquale Valentini 2022 年 11 月 4 日
thanks for your reply.
It is very useful, but it seems to me that using "pagemtimes" is not faster than using “For Loop Matlab"
Daniel Neubauer
Daniel Neubauer 2022 年 11 月 7 日
I dont know if there is a fasther way then, sorry!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by