Defines a normalized uniform distribution over a bounded rectangular domain. More...
#include <UniformBox.h>
Defines a normalized uniform distribution over a bounded rectangular domain.
This class defines a uniform distribution between coordinate-aligned lower and upper bounds. Let \(\theta \) denote the input random variable with components \(\theta_i\) for \(i\in \{1,2,\ldots, D\}\), let \(L_i \) denote the lower bound for component \(i\), and let \(U_i\) denote the upper bound on \(\theta_i \). Then, this class implements
\[ \pi(\theta) = \prod \pi_i(\theta_i), \]
where
\[ \pi_i(\theta_i) = U\left[ L_i, U_i \right] = \left\{ \begin{array}{ll}\frac{1}{U_i-L_i} & L_i\leq x_i \leq U_i \\ 0 & \text{Otherwise} \end{array}\right. . \]
This class can be initialized in three ways: with a matrix containing L_i and U_i, using std::pair<double,double> to collect the lower and upper bounds, and directly with a linear vector of doubles with entries that alternate between lower and upper bounds. The following code snippets are all equivalent approaches for constructing the uniform distribution.
Definition at line 83 of file UniformBox.h.
Public Member Functions | |
virtual | ~UniformBox ()=default |
UniformBox (Eigen::MatrixXd const &bounds) | |
Create a \(d\)-dimensional uniform distribution. More... | |
template<typename... Args> | |
UniformBox (std::pair< double, double > const &pair1, Args... args) | |
Create a \(d\)-dimensional uniform distribution. More... | |
UniformBox (std::vector< std::pair< double, double >> const &pairList) | |
template<typename... Args> | |
UniformBox (double lb1, double ub1, Args... args) | |
UniformBox (std::vector< double > const &bounds) | |
Public Member Functions inherited from muq::Modeling::Distribution | |
Distribution (unsigned int varSizeIn, Eigen::VectorXi const &hyperSizesIn=Eigen::VectorXi()) | |
virtual | ~Distribution ()=default |
virtual double | LogDensity (ref_vector< Eigen::VectorXd > const &inputs) |
Evaluate the log-density. More... | |
virtual double | LogDensity (std::vector< Eigen::VectorXd > const &inputs) |
VARIADIC_TO_REFVECTOR (LogDensity, Eigen::VectorXd, double) | |
virtual Eigen::VectorXd | GradLogDensity (unsigned int wrt, std::vector< Eigen::VectorXd > const &inputs) |
virtual Eigen::VectorXd | GradLogDensity (unsigned int wrt, ref_vector< Eigen::VectorXd > const &inputs) |
template<typename... Args> | |
Eigen::VectorXd | GradLogDensity (unsigned int wrt, Args... args) |
virtual Eigen::VectorXd | ApplyLogDensityHessian (unsigned int const inWrt1, unsigned int const inWrt2, ref_vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec) |
virtual Eigen::VectorXd | ApplyLogDensityHessian (unsigned int const inWrt1, unsigned int const inWrt2, std::vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec) |
Eigen::VectorXd | Sample (ref_vector< Eigen::VectorXd > const &inputs) |
Sample the distribution. More... | |
Eigen::VectorXd | Sample (std::vector< Eigen::VectorXd > const &inputs) |
Eigen::VectorXd | Sample () |
Sample the distribution with no inputs. More... | |
VARIADIC_TO_REFVECTOR (Sample, Eigen::VectorXd, Eigen::VectorXd) | |
std::shared_ptr< Density > | AsDensity () |
Returns a density built from this distribution. More... | |
std::shared_ptr< RandomVariable > | AsVariable () |
Returns a random variable built from this distribution. More... | |
Additional Inherited Members | |
Public Attributes inherited from muq::Modeling::Distribution | |
const unsigned int | varSize |
const Eigen::VectorXi | hyperSizes |
|
virtualdefault |
UniformBox::UniformBox | ( | Eigen::MatrixXd const & | bounds | ) |
Create a \(d\)-dimensional uniform distribution.
[in] | bounds | A \(d\)-dimensional vector, each entry is a pair—first: lower bound in the dimension, second: upper bound in that dimension |
Definition at line 8 of file UniformBox.cpp.
|
inline |
Create a \(d\)-dimensional uniform distribution.
[in] | args | The upper/lower bound pairs (may be more than one) |
Definition at line 99 of file UniformBox.h.
|
inline |
Definition at line 101 of file UniformBox.h.
|
inline |
Definition at line 104 of file UniformBox.h.
|
inline |
Definition at line 106 of file UniformBox.h.
|
staticprivate |
A matrix describing the bounding box.
A matrix that discribes the bounding box. The first row contains the lower bounds and the second row corresponds to the upper bound. Each column corresponds to a different inpu dimension.
Definition at line 15 of file UniformBox.cpp.
|
staticprivate |
Definition at line 20 of file UniformBox.cpp.
|
overrideprivatevirtual |
Evaluate the log-density.
Inputs:
Reimplemented from muq::Modeling::Distribution.
Definition at line 44 of file UniformBox.cpp.
References volume.
|
overrideprivatevirtual |
Sample the distribution.
Reimplemented from muq::Modeling::Distribution.
Definition at line 61 of file UniformBox.cpp.
|
private |
Definition at line 146 of file UniformBox.h.
Referenced by LogDensityImpl().