Acceleration of some mathematical arithmetic operation

I have two matrices A and B.

B is just a matrix with one of the diagonal elements other than zero. All off-diagonal elements are also equal to zero. I have to calculate $ A ^ {- 1} B $. My matrix $ A ^ {- 1} B $ is sparse. In Matlab, I can do A \ B. But is there a trick to speed it even further?

I have a group of B-matrices in which only one of the diagonal elements is non-zero and the off-diagonal elements are zero. I cannot store $ A ^ {- 1} $. Is there any way to speed this up?

+4
source share
2 answers

$(i, i) ^ {th} $ $B $ , $A ^ {- 1} $, $i ^ {th} $ $A ^ {- 1} $ . $i ^ {th} $$ A ^ {- 1} $, $A $, -; $i ^ {th} $ $A ^ {- 1} $.

0

. , (C say)

a) A NxN

b) B ( NxN)

c) A*B

C = zeros(size(A));
new_B = diag(B)';
[A_rows, A_cols] = size(A);
for i=1:A_rows
    C(i,:) = A(i,:).*new_B;
end
-1

All Articles