gmm: Multiply two matrices with the output matrix allready...

Description Usage Arguments Details Value Author(s) Examples

View source: R/04operations.R

Description

In effect this function sets C <- A %*% B. This makes it possible to avoid repeated allocation and deallocation steps which are very computationaly costly.

Usage

1
gmm(A, B, C, trA=FALSE, trB=FALSE,  accum=FALSE) 

Arguments

A, B

Matrices to multiply together.

C

Matrices where output will be saved.

trA, trB

Should A or B be transposed.

accum

if accum is set to TRUE, the multiplied matrix will be added to C (i.e. C<-C+A %*% B).

Details

This function takes advantage of the fact that gmatrix objects are stored as pointers making it posible modify the input to a function. Thus the area of memory on the GPU pointed to by the C object is modified to contain A %*% B.

Value

Returns C invisibly.

Author(s)

Nathan Morris

Examples

1
2
3
4
5
A=gmatrix(rnorm(10), 2, 5)
B=gmatrix(rnorm(10), 5, 2)
C=gmatrix(0,2,2)
gmm(A,B,C)
gmm(B,A,C,TRUE,TRUE)

njm18/gmatrix documentation built on May 23, 2019, 7:07 p.m.