Learn R Programming

hdtg (version 0.3.3)

createNutsEngine: Create a Zigzag-NUTS engine object

Description

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

Usage

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

Value

a list whose only element is the Zigzag-NUTS 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.

stepSize

the base step size for Zigzag-NUTS.

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(), createEngine()

Examples

Run this code
# Create a Zigzag-NUTS engine for a 2D problem
dimension <- 2
lowerBounds <- c(-2, -2)
upperBounds <- c(2, 2)
stepSize <- 0.1
mean <- c(0.5, -0.5)
precision <- matrix(c(2, 0.3, 0.3, 2), nrow = 2)
nuts_engine <- createNutsEngine(dimension, lowerBounds, upperBounds,
                                seed = 456, stepSize, mean, precision)
str(nuts_engine)

Run the code above in your browser using DataLab