How I compute multiple sum in matlab for 4D matrix?
2 ビュー (過去 30 日間)
古いコメントを表示
How I compute multiple sum in matlab for 4D matrices as below? U and V are 4D matrices.
12 件のコメント
回答 (1 件)
Matt J
2018 年 9 月 11 日
編集済み: Matt J
2018 年 9 月 11 日
Notice that the only indices shared between U and V are j and q. Therefore, you can minimize multiplication operations as follows,
partialU=sum(sum(U,4),1); %sum over i and r
partialV=sum(sum(V,4),1); %sum over k and s
A=sum(partialU(:).*partialV(:)); %sum over j and q
6 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!