[R] matrix.csr %*% matrix --> matrix

Martin Maechler maechler at stat.math.ethz.ch
Wed Nov 7 10:10:51 CET 2012


>>>>> "Sam" == Sam Steingold <sds at gnu.org>
>>>>>     on Tue, 6 Nov 2012 13:08:30 -0500 writes:

    Sam> The question is even more pressing for me now given that I no longer can
    Sam> convert some csr matrices to the regular ones for scaling.
    Sam> (http://article.gmane.org/gmane.comp.lang.r.general:279305)
    Sam> Any suggestions? (the original csr matrix is too large to be converted
    Sam> to a regular one, but the product is small enough).

    >> * Sam Steingold <fqf at tah.bet> [2012-08-27 14:58:47 -0400]:
    >> 
    >> When a sparse matrix is multiplied by a regular one, the result is
    >> usually not sparse. However, when matrix.csr is multiplied by a regular
    >> matrix in R, a matrix.csr is produced.
    >> Is there a way to avoid this?
    >> Thanks!

Why don't you use the sparse matrix classes from the Matrix
package .. which is part of every R distribution ?
"SparseM" has been written as very first package to support
sparse matrices, and is to be applauded for that,
but it does lack many features nowadays (and also uses less
modern algorithm for e.g. the sparse Cholesky decomposition).

Martin Maechler
the (biased!) Co-author of the Matrix package.




More information about the R-help mailing list