how to block diagonalize a 3D matrix
이전 댓글 표시
how to blkdiag a 3D matrix. The blkdiag operation is done to 2D slice along dim 3
답변 (1개)
Teja Muppirala
2013년 1월 11일
R = rand(4,2,3);
M = mat2cell(R,4,2,ones(1,size(R,3)));
M = blkdiag(M{:})
댓글 수: 1
Timothy
2016년 1월 26일
Hmm. Make that third dimension a lot bigger.
R = rand(4,2,65341); tic M = mat2cell(R, 4,2,ones(1, size(R,3))); toc
Elapsed time is 6.065165 seconds.
I was hoping to use blkdiag to perform a [3x2] * [2 x 1] calculation a whole bunch of times, P = 65341 times. For looping through takes 2.5s. Setting up the block diagonal in this way is much slower. Is there a faster way?
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!