Sparse matrix multiplication in MATLAB with spfun -
i have dense column matrix y of size (m,1) , sparse matrix x of size (m,n).
want element-wise multiplication using y , every column of x.
resultant sparse matrix still of size (m,n).
sparse matrix x, when loaded memory, 10gb.
can spfun me accomplish goal in memory efficient manner?
i having difficulties understanding logic behind it.
thank you.
have tried bsxfun?
out = bsxfun( @times, x, y ); spfun more suitable element-wise operations manipulate each non-zero element of x. not fit matrix-vector element wise operations.
however, if want along line, might try:
[ii jj xij] = find(x); %// extract non-zeros of x , locations out = sparse( ii, jj, xij.*y(ii), size(x,1), size(x,2) ); see doc find more information.
Comments
Post a Comment