oclSampling: Function to call OpenCL for rejection sampling.

Description Usage Arguments Value Author(s) Examples

View source: R/oclSampling.R

Description

Function to call OpenCL for rejection sampling.

Usage

1
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

Author(s)

Kate Cowles

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
##---- 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) )
  }

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