oclKronVectMult1col: Function to call OpenCL program to compute product of a...

Description Usage Arguments Value Examples

View source: R/oclKronVectMult1col.R

Description

Function to call OpenCL program to compute product of a Kronecker product of two matrices times another matrix.

Usage

1

Arguments

kernel

OpenCL kernel to be run

a

left matrix in kronecker product

b

right matrix in kronecker product

y

vector to be premultiplied by kronecker product of a and b

Value

matrix; the product kronecker(a,b)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(a,b,c)
{
   if(!is.numeric(a) | !is.numeric(b) | !is.numeric(c) )
          stop("a and b must be numeric matrices")

   na1 <- nrow(a)
   nb1 <- nrow(b)
   nc1 <- ncol(c)
   a<- as.vector(t(a))
   b<- as.vector(t(b))
   c<- as.vector(c)     # change; not transposed before sent
   retvect <- rep(0, na1 * nb1 * nc1)

   out <- .C("doKronVectMult1colD", a=as.double(a), b = as.double(b),
              c = as.double(c),
               retvect=as.double(retvect), na1 = as.integer(na1),
               nb1 = as.integer(nb1), nc1 = as.integer(nc1), PACKAGE="CARramps" )
   return(matrix(out$retvect, nrow=na1*nb1,byrow=F) ) # change byrow
  }

CARrampsOcl documentation built on May 2, 2019, 3:27 a.m.