CMP++: Uncertainty Quantification & Bayesian Calibration
Loading...
Searching...
No Matches
cmp::grid::LatinHypercubeGrid Class Reference

Latin Hypercube Sampling (LHS) grid generator. More...

#include <grid.h>

Inheritance diagram for cmp::grid::LatinHypercubeGrid:
Collaboration diagram for cmp::grid::LatinHypercubeGrid:

Public Member Functions

 LatinHypercubeGrid (const Eigen::Ref< const Eigen::VectorXd > &lowerBound, const Eigen::Ref< const Eigen::VectorXd > &upperBound, unsigned int seed=42)
 Constructs a LatinHypercubeGrid generator.
 
Eigen::MatrixXd construct (const size_t &nPoints) override
 Constructs a Latin Hypercube matrix of samples.
 
size_t dim () const override
 Returns the dimension of the domain.
 
- Public Member Functions inherited from cmp::grid::Grid
virtual ~Grid ()=default
 

Private Attributes

size_t dimension_
 Number of dimensions.
 
std::default_random_engine rng_
 Pseudo-random number generator.
 
Eigen::VectorXd lowerBound_
 Lower bounds vector.
 
Eigen::VectorXd upperBound_
 Upper bounds vector.
 

Detailed Description

Latin Hypercube Sampling (LHS) grid generator.

Mathematical Formulation For each dimension \(d \in \{1,\dots,D\}\), LHS divides the domain range \([a_d, b_d]\) into \(N\) equal-probability bins. The coordinate values for the \(i\)-th sample is placed inside the \(\pi_d(i)\)-th bin:

\[ x_{i, d} = a_d + \frac{b_d - a_d}{N} \left( \pi_d(i) - 1 + u_{i,d} \right) \]

where \(\pi_d\) is a random permutation of the set \(\{1,\dots,N\}\) chosen independently for each dimension, and \(u_{i,d} \sim \mathcal{U}(0, 1)\) is a random jitter.

Implementation Algorithm

  1. Allocates \(N \times D\) matrix.
  2. For each dimension \(d\), generates a vector of indices \(\{0, \dots, N-1\}\) and shuffles it.
  3. Draws a random uniform offset \(u\) inside each bin and maps the resulting value to the target hyperrectangle bounds.

Constructor & Destructor Documentation

◆ LatinHypercubeGrid()

cmp::grid::LatinHypercubeGrid::LatinHypercubeGrid ( const Eigen::Ref< const Eigen::VectorXd > &  lowerBound,
const Eigen::Ref< const Eigen::VectorXd > &  upperBound,
unsigned int  seed = 42 
)
inline

Constructs a LatinHypercubeGrid generator.

Parameters
lowerBoundThe lower bounds of the hyperrectangle.
upperBoundThe upper bounds of the hyperrectangle.
seedSeed for the random number generator.

Member Function Documentation

◆ construct()

Eigen::MatrixXd cmp::grid::LatinHypercubeGrid::construct ( const size_t &  nPoints)
inlineoverridevirtual

Constructs a Latin Hypercube matrix of samples.

Parameters
nPointsNumber of points to generate.

Implements cmp::grid::Grid.

◆ dim()

size_t cmp::grid::LatinHypercubeGrid::dim ( ) const
inlineoverridevirtual

Returns the dimension of the domain.

Implements cmp::grid::Grid.

Member Data Documentation

◆ dimension_

size_t cmp::grid::LatinHypercubeGrid::dimension_
private

Number of dimensions.

◆ lowerBound_

Eigen::VectorXd cmp::grid::LatinHypercubeGrid::lowerBound_
private

Lower bounds vector.

◆ rng_

std::default_random_engine cmp::grid::LatinHypercubeGrid::rng_
private

Pseudo-random number generator.

◆ upperBound_

Eigen::VectorXd cmp::grid::LatinHypercubeGrid::upperBound_
private

Upper bounds vector.


The documentation for this class was generated from the following file: