Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


mcmcsae (version 0.6.0)

matrix-vector: Fast matrix-vector multiplications

Description

Functions for matrix-vector multiplies like %*% and crossprod, but often faster for the matrix types supported. The return value is always a numeric vector.

Usage

M %m*v% v

crossprod_mv(M, v)

Arguments

M

a matrix of class 'matrix', 'dgCMatrix', 'dsCMatrix', 'tabMatrix', or 'ddiMatrix'.

v

a numeric vector.

Value

For %m*v% the vector Mv and for crossprod_mv the vector Mv where M denotes the transpose of M.

Examples

Run this code
# NOT RUN {
M <- matrix(rnorm(10*10), 10, 10)
x <- rnorm(10)
M %m*v% x
crossprod_mv(M, x)
M <- Matrix::rsparsematrix(100, 100, nnz=100)
x <- rnorm(100)
M %m*v% x
crossprod_mv(M, x)

# }

Run the code above in your browser using DataLab