rsparse (version 0.4.0)

matmult: Multithreaded Sparse-Dense Matrix Multiplication

Description

Multithreaded %*%, crossprod, tcrossprod for sparse-dense matrix multiplication

Usage

# S4 method for dgRMatrix,matrix
%*%(x, y)

# S4 method for dgRMatrix,float32 %*%(x, y)

# S4 method for float32,dgRMatrix %*%(x, y)

# S4 method for dgRMatrix,matrix tcrossprod(x, y)

# S4 method for dgRMatrix,float32 tcrossprod(x, y)

# S4 method for matrix,dgCMatrix %*%(x, y)

# S4 method for float32,dgCMatrix %*%(x, y)

# S4 method for dgCMatrix,float32 %*%(x, y)

# S4 method for matrix,dgCMatrix crossprod(x, y)

# S4 method for float32,dgCMatrix crossprod(x, y)

Arguments

x, y

dense matrix and sparse Matrix::RsparseMatrix / Matrix::CsparseMatrix matrices.

Value

A dense matrix

Details

Accelerates sparse-dense matrix multiplications using openmp. Applicable to the following pairs: (dgRMatrix, matrix), (matrix, dgRMatrix), (dgCMatrix, matrix), (matrix, dgCMatrix) combinations

Examples

Run this code
# NOT RUN {
library(Matrix)
data("movielens100k")
k = 10
nc = ncol(movielens100k)
nr = nrow(movielens100k)
x_nc = matrix(rep(1:k, nc), nrow = nc)
x_nr = t(matrix(rep(1:k, nr), nrow = nr))
csc = movielens100k
csr = as(movielens100k, "RsparseMatrix")
dense = as.matrix(movielens100k)
identical(csr %*% x_nc, dense %*% x_nc)
identical(x_nr %*% csc, x_nr %*% dense)
# }

Run the code above in your browser using DataCamp Workspace