How to operate block matrices?
13 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Rik
2022 年 10 月 7 日
You will have to store your matrix as a 3-D matrix. Even if pagemtimes is not what you want, that will make it easier to write a loop to apply the operation you do want.
2 件のコメント
Image Analyst
2022 年 10 月 7 日
Can you explain exactly what was multiplied by what, and summed, to get the output matrixes?
その他の回答 (1 件)
Paul
2022 年 10 月 7 日
One can always store block matrices in cell arrays and then roll code to implement the block matrix algebra. Maybe there is a submittal on the FEX for a block matrix class?
A = {[1 2] , [3 4]; [3 5] , [4 2]};
B = {1 , 2; 3, 4};
C = blockmtimes(B,A)
function C = blockmtimes(A,B)
[m,n] = size(A);
[n,s] = size(B);
for ii = 1:m
for jj = 1:n
C{ii,jj} = zeros(size(A{ii,jj},1),size(B{ii,jj},2));
for kk = 1:n
C{ii,jj} = C{ii,jj} + A{ii,kk}*B{kk,jj};
end
end
end
end
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!