I have a sparse matrix which only has elements in three diagonals. E.g.
I also have a column vector where I wish to multiply every element in each row of the sparse matrix by the corresponding element in each row of the column vector. Is there an efficient way to do this in MATLAB? If the sparse matrix is called A
and the column vector B
, I've only tried
A.*repmat(B,[1,9])
which is obviously inefficient.