How tdo I apply the matrix log block-diagonally?
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi there!
I'm have a parameter-dependent unitary 2x2 matrix. The parameter (call it k) takes on a huge number of values (approx 10^4 and more). I need to calculate the matrix-log of this 2x2 matrix for each value of k. Instead of looping over all k's, I'm trying to vectorise the code by putting all those 2x2 matrices in the diagonal of a huge matrix such that I get a huge but very sparse block-diagonal matrix.
This huge block-diagonal matrix consists entirely of very small 2x2 blocks. I want to take the matrix log of it efficiently. The built-in logm function does not accept a sparse matrix as input. For large matrices, using logm( full(.) ) of the matrix becomes very time-consuming and renders my vectorisation attempt useless.
Is there a way of applying the logm (or equivalently expm or other matrix functions) block-diagonally? In other words, I want to apply the element-wise log to the matrix, but the matrix logm on the blocks with one operation? The result should be a block-diagonal matrix of the matrix-log of the separate 2x2 blocks.
Alternatively, is there a way of applying logm to sparse matrices? Or maybe another better-suited vectorisation procedure?
Thanks a lot!
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 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!