1 #ifndef DISTRIBUTION_H_
2 #define DISTRIBUTION_H_
18 class Distribution :
public std::enable_shared_from_this<Distribution> {
24 Eigen::VectorXi
const& hyperSizesIn = Eigen::VectorXi()) :
varSize(varSizeIn),
43 template<
typename... Args>
51 unsigned int const inWrt2,
53 Eigen::VectorXd
const& vec);
57 unsigned int const inWrt2,
58 std::vector<Eigen::VectorXd>
const& input,
157 throw muq::NotImplementedError(std::string(
"LogDensityImpl function has not been implemented for class ") +
typeid(*this).name());
171 throw muq::NotImplementedError(std::string(
"SampleImpl function has not been implemented for class ") +
typeid(*this).name());
172 return Eigen::VectorXd();
179 template<
typename... Args>
181 inputs.push_back(std::cref(in));
virtual Eigen::VectorXd GradLogDensityImpl(unsigned int wrt, ref_vector< Eigen::VectorXd > const &inputs)
virtual double LogDensityImpl(ref_vector< Eigen::VectorXd > const &inputs)
Implement the log-density.
std::shared_ptr< Density > AsDensity()
Returns a density built from this distribution.
virtual Eigen::VectorXd SampleImpl(ref_vector< Eigen::VectorXd > const &inputs)
Sample the distribution.
Eigen::VectorXd Sample(std::vector< Eigen::VectorXd > const &inputs)
virtual Eigen::VectorXd ApplyLogDensityHessian(unsigned int const inWrt1, unsigned int const inWrt2, std::vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec)
virtual Eigen::VectorXd ApplyLogDensityHessian(unsigned int const inWrt1, unsigned int const inWrt2, ref_vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec)
virtual double LogDensity(ref_vector< Eigen::VectorXd > const &inputs)
Evaluate the log-density.
virtual double LogDensity(std::vector< Eigen::VectorXd > const &inputs)
Eigen::VectorXd GradLogDensity(unsigned int wrt, Args... args)
Eigen::VectorXd Sample()
Sample the distribution with no inputs.
VARIADIC_TO_REFVECTOR(Sample, Eigen::VectorXd, Eigen::VectorXd)
virtual Eigen::VectorXd GradLogDensity(unsigned int wrt, std::vector< Eigen::VectorXd > const &inputs)
virtual ~Distribution()=default
Distribution(unsigned int varSizeIn, Eigen::VectorXi const &hyperSizesIn=Eigen::VectorXi())
ref_vector< const Eigen::VectorXd > ToRefVector(std::vector< Eigen::VectorXd > const &anyVec) const
VARIADIC_TO_REFVECTOR(LogDensity, Eigen::VectorXd, double)
std::shared_ptr< RandomVariable > AsVariable()
Returns a random variable built from this distribution.
Eigen::VectorXd GradLogDensity(unsigned int wrt, ref_vector< Eigen::VectorXd > &inputs, Eigen::VectorXd const &in, Args... args)
const unsigned int varSize
const Eigen::VectorXi hyperSizes
virtual Eigen::VectorXd ApplyLogDensityHessianImpl(unsigned int wrt1, unsigned int wrt2, ref_vector< Eigen::VectorXd > const &inputs, Eigen::VectorXd const &vec)
Class for virtual base functions that are not implemented.
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...