Latin Hypercube Samples (lhs)  1.0
R, C++, and Rcpp code to generate Latin hypercube samples
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
lhs_r Namespace Reference

Classes

class  RStandardUniform
 

Functions

void findorder_zero (const Rcpp::NumericVector &v, Rcpp::IntegerVector &order)
 
Rcpp::NumericMatrix convertIntegerToNumericLhs (const bclib::matrix< int > &intMat)
 
Rcpp::NumericMatrix convertIntegerToNumericLhs (const Rcpp::IntegerMatrix &intMat)
 
Rcpp::NumericMatrix convertMatrixToNumericLhs (const bclib::matrix< double > &intMat)
 
Rcpp::IntegerVector runifint (unsigned int n, int min_int, int max_int)
 
void checkArguments (int n, int k)
 
void checkArguments (int n, int k, int dup)
 
void checkArguments (int n, int k, int maxsweeps, double eps)
 
Rcpp::NumericMatrix degenerateCase (int k, bclib::CRandom< double > &oRandom)
 
template<int RTYPE>
Rcpp::NumericMatrix calculateDistance (Rcpp::Matrix< RTYPE > &mat)
 
template<int RTYPE>
double calculateSOptimal (Rcpp::Matrix< RTYPE > &mat)
 

Detailed Description

a namespace for the lhs methods used in the R interface

Function Documentation

◆ calculateDistance()

template<int RTYPE>
Rcpp::NumericMatrix lhs_r::calculateDistance ( Rcpp::Matrix< RTYPE > &  mat)

Calculate the distance between points in a matrix

Parameters
matthe matrix to use for the calculation
Template Parameters
RTYPEthe type of SEXP
Returns
the matrix of distances

◆ calculateSOptimal()

template<int RTYPE>
double lhs_r::calculateSOptimal ( Rcpp::Matrix< RTYPE > &  mat)

calculate the S optimal criterion

Parameters
matthe input matrix
Template Parameters
RTYPEthe type of SEXP
Returns
the S optimality criterion

◆ checkArguments() [1/3]

void lhs_r::checkArguments ( int  n,
int  k 
)

check the arguments are valid

Parameters
nnumber of rows / samples in the lhs
knumber parameters / columns in the lhs

◆ checkArguments() [2/3]

void lhs_r::checkArguments ( int  n,
int  k,
int  dup 
)

check that the arguments are valid

Parameters
nnumber of rows / samples in the lhs
knumber parameters / columns in the lhs
dupA factor that determines the number of candidate points used in the search.

◆ checkArguments() [3/3]

void lhs_r::checkArguments ( int  n,
int  k,
int  maxsweeps,
double  eps 
)

check that the arguments are valid

Parameters
nnumber of rows / samples in the lhs
knumber parameters / columns in the lhs
maxsweepsthe maximum number of sweeps to use in the algorithm
epsThe optimal stopping criterion

◆ convertIntegerToNumericLhs() [1/2]

Rcpp::NumericMatrix lhs_r::convertIntegerToNumericLhs ( const bclib::matrix< int > &  intMat)

convert an integer matrix to a numeric latin hypercube sample

Parameters
intMatthe input matrix to be converted
Returns
a latin hypercube sample

◆ convertIntegerToNumericLhs() [2/2]

Rcpp::NumericMatrix lhs_r::convertIntegerToNumericLhs ( const Rcpp::IntegerMatrix &  intMat)

convert a Rcpp::IntegerMatrix to a numeric latin hypercube sample

Parameters
intMatthe input matrix to be converted
Returns
a Latin hypercube sample

◆ convertMatrixToNumericLhs()

Rcpp::NumericMatrix lhs_r::convertMatrixToNumericLhs ( const bclib::matrix< double > &  intMat)

convert a numeric matrix to a numeric latin hypercube sample

Parameters
intMatthe input matrix to be converted
Returns
a Latin hypercube sample

◆ degenerateCase()

Rcpp::NumericMatrix lhs_r::degenerateCase ( int  k,
bclib::CRandom< double > &  oRandom 
)

develop an lhs sample in the degenerate case

Parameters
knumber parameters / columns in the lhs
oRandoma random number generator for the hypercube
Returns
the numeric matrix for the degenerate case

◆ findorder_zero()

void lhs_r::findorder_zero ( const Rcpp::NumericVector &  v,
Rcpp::IntegerVector &  order 
)

find the order of an input vector using 0 as the first order

Parameters
vthe input values
orderthe order of the input values

◆ runifint()

Rcpp::IntegerVector lhs_r::runifint ( unsigned int  n,
int  min_int,
int  max_int 
)

a uniform integer sample between min and max

Parameters
nthe size of the sample
min_intthe minimum integer in the sample
max_intthe maximum integer in the sample
Returns
an integer vector