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 ?

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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -