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?
$(i, i) ^ {th} $ $B $ , $A ^ {- 1} $, $i ^ {th} $ $A ^ {- 1} $ . $i ^ {th} $$ A ^ {- 1} $, $A $, -; $i ^ {th} $ $A ^ {- 1} $.
. , (C say)
C
a) A NxN
A
b) B ( NxN)
B
c) A*B
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