Learn R Programming

CARrampsOcl (version 0.1.4)

oclSampling: Function to call OpenCL for rejection sampling.

Description

Function to call OpenCL for rejection sampling.

Usage

oclSampling(kernel, smat, alpha, beta = beta, D, By, k)

Arguments

kernel
OpenCL kernel to be run
smat
alpha
beta
D
By
k

Value

  • matrix; first column is log of marginalized posterior density of each candidate vector, and second column is beta parameter for generating a corresponding value of tausqtot from a gamma density

Examples

Run this code
##---- 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( smat, alpha, beta=beta, D, By, k)
{
   N1 <- length(By)
   F1 <- ncol(smat) + 1
   nsamp1 <- nrow(smat)
   logpostdens <- newbetaret <- rep(0,nsamp1 )
   out <- .C("doSamplingD",  smat=as.double(as.vector(t(smat))), 
      D = as.double(as.vector(t(D))), 
      By = as.double(By),
      alpha = as.double(alpha),
      beta = as.double(beta), logpostdens = as.double(logpostdens), 
      newbetaret = as.double(newbetaret),
      nsamp1 = as.integer(nsamp1), N1 = as.integer(N1), 
      F1 = as.integer(F1), nk1 = as.integer(k), PACKAGE="CARramps")
   return( cbind( out$logpostdens, out$newbetaret) )
  }

Run the code above in your browser using DataLab