9 Eigen::VectorXd
const& betaIn) :
Distribution(alphaIn.size()),
12 logConst(ComputeConstant(alphaIn, betaIn))
16 double betaIn) :
InverseGamma(alphaIn*Eigen::VectorXd::Ones(1),
17 betaIn*Eigen::VectorXd::Ones(1)){};
20 Eigen::VectorXd
const& betaIn)
23 for(
int i=0; i<alphaIn.size(); ++i)
24 logConst += alphaIn(i)*std::log(betaIn(i)) - std::lgamma(alphaIn(i));
31 Eigen::VectorXd
const& x = inputs.at(0).get();
33 if(x.minCoeff()<std::numeric_limits<double>::epsilon())
34 return -1.0*std::numeric_limits<double>::infinity();
36 return logConst + ((-
alpha.array()-1.0)*x.array().log() -
beta.array() / x.array()).sum();
42 Eigen::VectorXd output(
alpha.size());
43 for(
int i=0; i<
alpha.size(); ++i)
44 output(i) = 1.0/RandomGenerator::GetGamma(
alpha(i),1.0/
beta(i));
const Eigen::VectorXd beta
const Eigen::VectorXd alpha
static double ComputeConstant(Eigen::VectorXd const &alphaIn, Eigen::VectorXd const &betaIn)
InverseGamma(double alphaIn, double betaIn)
virtual double LogDensityImpl(ref_vector< Eigen::VectorXd > const &inputs) override
Implement the log-density.
virtual Eigen::VectorXd SampleImpl(ref_vector< Eigen::VectorXd > const &inputs) override
Sample the distribution.
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...