Hi, creating a matrix from two vectors a, b by multiplying each combination can be done e.g. via
a %*% t(b) or via outer(a, b) # default for third argument is '*' But this yields a normal matrix. Is there an efficient way to create sparse matrices (from the Matrix package) like that? Right now i’m doing a.sparse = as(a, 'sparseVector') b.sparse = as(t(b), 'sparseMatrix') a.sparse %*% b.sparse but this strikes me as wasteful. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.