Learn R Programming

gmatrix (version 0.3)

gmatTimesDiagVec: Multiply a matrix times the 'diag' of a vector quickly.

Description

This function calculates A %*% diag(v). It is much faster than the direct calculation as it avoids the huge matrix multiplication problem.

Usage

gmatTimesDiagVec(A, v)

Arguments

A
An object of class gmatrix or 'matrix'.
v
An object of class 'gvecotr' or a 'vector'.

Value

Returns a gmatrix

See Also

diag

Examples

Run this code
v=grnorm(10)
A=gmatrix(grnorm(100),10,10,dup=FALSE)
gmatTimesDiagVec(A, v)

Run the code above in your browser using DataLab