21 params.
addRequiredParam<dof_id_type>(
"num_rows",
"The size of the square matrix to generate.");
24 "The distribution names to be sampled, the number of distributions provided defines the "
25 "number of columns per matrix.");
32 const auto & distribution_names = getParam<std::vector<DistributionName>>(
"distributions");
33 for (
const DistributionName &
name : distribution_names)
48 const auto seed =
getRandl(col, 0, std::numeric_limits<uint32_t>::max(), 1);
56 mooseAssert(
_shufflers.size() > 0,
"Shufflers have not been initialized.");
64 const auto bin =
_shufflers[col_index]->permute(row_index);
67 const auto lower = bin * bin_size;
68 const auto upper = (bin + 1) * bin_size;
69 const Real probability =
registerMooseObjectAliased("StochasticToolsApp", LatinHypercubeSampler, "LatinHypercube")
const Distribution & getDistributionByName(const DistributionName &name) const
Implements Latin Hypercube Sampling (LHS) over a set of distributions.
virtual Real computeSample(dof_id_type row_index, dof_id_type col_index) override
Return the sample value for the given row and column.
std::vector< std::unique_ptr< MooseRandomPerturbation > > _shufflers
Per-column pseudo-random permuters that enforce the LHS bin assignment.
LatinHypercubeSampler(const InputParameters ¶meters)
virtual void executeTearDown() override
Constructs one MooseRandomPerturbation per column, each seeded independently from generator 1.
std::vector< Distribution const * > _distributions
Distribution objects, one per column, whose quantile functions are sampled.
static InputParameters validParams()
const std::string & name() const
void setNumberOfCols(dof_id_type n_cols)
Real getRand(std::size_t n, unsigned int index=0) const
unsigned int getRandl(std::size_t n, unsigned int lower, unsigned int upper, unsigned int index=0) const
dof_id_type getNumberOfRows() const
static InputParameters validParams()
dof_id_type getNumberOfCols() const
void setNumberOfRows(dof_id_type n_rows)
void setNumberOfRandomSeeds(std::size_t number)