Allows for elementwise multiplication between sparse matrix A and vector b using broadcasting. Download
A = sparse(3,3); A(2,2) = 1; A(2,3) = 1; A(3,2) = 1; A(3,3) = 1; b = [1; 2; 3]; full(A) full(spbroadcast(A,b)) full(spbroadcast(A,b')) ## === expected output === ## ans = ## ## 0 0 0 ## 0 1 1 ## 0 1 1 ## ans = ## ## 0 0 0 ## 0 2 2 ## 0 3 3 ## ans = ## ## 0 0 0 ## 0 2 3 ## 0 2 3