Learn R Programming

hdtg (version 0.3.3)

createEngine: Create a Zigzag-HMC engine object

Description

Create the C++ object to set up SIMD vectorization for speeding up calculations for Zigzag-HMC ("Zigzag-HMC engine").

Usage

createEngine(
  dimension,
  lowerBounds,
  upperBounds,
  seed,
  mean,
  precision,
  flags = 128L,
  numThreads = 1L
)

Value

a list whose only element is the Zigzag-HMC engine object.

Arguments

dimension

the dimension of MTN.

lowerBounds

a vector specifying the lower bounds.

upperBounds

a vector specifying the upper bounds.

seed

random seed.

mean

the mean vector.

precision

the precision matrix.

flags

which SIMD instruction set to use. 128 = SSE, 256 = AVX.

numThreads

number of threads for parallel execution (default = 1). Set to 0 for automatic detection of available cores.

See Also

setMean(), setPrecision(), zigzagHMC(), markovianZigzag()

Examples

Run this code
# Create a 2D engine with simple bounds
dimension <- 2
lowerBounds <- c(-1, -1)
upperBounds <- c(1, 1)
mean <- c(0, 0)
precision <- matrix(c(1, 0.5, 0.5, 1), nrow = 2)
engine <- createEngine(dimension, lowerBounds, upperBounds, 
                       seed = 123, mean, precision, flags = 128)
# Check the engine structure
str(engine)

Run the code above in your browser using DataLab