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

Standard Monte Carlo random grid generator. More...

#include <grid.h>

Inheritance diagram for cmp::grid::MonteCarloGrid:
Collaboration diagram for cmp::grid::MonteCarloGrid:

Public Member Functions

 MonteCarloGrid (const Eigen::Ref< const Eigen::VectorXd > &lowerBound, const Eigen::Ref< const Eigen::VectorXd > &upperBound, unsigned int seed=42)
 Constructs a MonteCarloGrid generator.
 
Eigen::MatrixXd construct (const size_t &nPoints) override
 Constructs a matrix of random Monte Carlo samples.
 
Eigen::VectorXd operator() ()
 Evaluates a single random Monte Carlo sample.
 
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.
 
std::uniform_real_distribution< double > dist_
 Uniform distribution range [0, 1].
 
Eigen::VectorXd lowerBound_
 Lower bounds vector.
 
Eigen::VectorXd upperBound_
 Upper bounds vector.
 

Detailed Description

Standard Monte Carlo random grid generator.

Mathematical Formulation Generates independent and identically distributed (i.i.d.) samples drawn uniformly from the design space:

\[ \mathbf{x}_i \sim \mathcal{U}\left( \prod_{d=1}^D [a_d, b_d] \right) \]

Constructor & Destructor Documentation

◆ MonteCarloGrid()

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

Constructs a MonteCarloGrid generator.

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

Member Function Documentation

◆ construct()

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

Constructs a matrix of random Monte Carlo samples.

Parameters
nPointsNumber of points to generate.

Implements cmp::grid::Grid.

◆ dim()

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

Returns the dimension of the domain.

Implements cmp::grid::Grid.

◆ operator()()

Eigen::VectorXd cmp::grid::MonteCarloGrid::operator() ( )
inline

Evaluates a single random Monte Carlo sample.

Member Data Documentation

◆ dimension_

size_t cmp::grid::MonteCarloGrid::dimension_
private

Number of dimensions.

◆ dist_

std::uniform_real_distribution<double> cmp::grid::MonteCarloGrid::dist_
private

Uniform distribution range [0, 1].

◆ lowerBound_

Eigen::VectorXd cmp::grid::MonteCarloGrid::lowerBound_
private

Lower bounds vector.

◆ rng_

std::default_random_engine cmp::grid::MonteCarloGrid::rng_
private

Pseudo-random number generator.

◆ upperBound_

Eigen::VectorXd cmp::grid::MonteCarloGrid::upperBound_
private

Upper bounds vector.


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