multi_student_t_rng.hpp
Go to the documentation of this file.
#ifndef STAN_MATH_PRIM_MAT_PROB_MULTI_STUDENT_T_RNG_HPP
#define STAN_MATH_PRIM_MAT_PROB_MULTI_STUDENT_T_RNG_HPP
#include <boost/math/special_functions/gamma.hpp>
#include <boost/random/variate_generator.hpp>
#include <stan/math/prim/mat/err/check_ldlt_factor.hpp>
#include <stan/math/prim/scal/err/check_size_match.hpp>
#include <stan/math/prim/mat/err/check_symmetric.hpp>
#include <stan/math/prim/scal/err/check_finite.hpp>
#include <stan/math/prim/scal/err/check_not_nan.hpp>
#include <stan/math/prim/scal/err/check_positive.hpp>
#include <stan/math/prim/mat/fun/multiply.hpp>
#include <stan/math/prim/mat/fun/dot_product.hpp>
#include <stan/math/prim/mat/fun/subtract.hpp>
#include <stan/math/prim/scal/fun/log1p.hpp>
#include <stan/math/prim/scal/fun/constants.hpp>
#include <stan/math/prim/mat/prob/multi_normal_rng.hpp>
#include <stan/math/prim/scal/prob/inv_gamma_rng.hpp>
#include <stan/math/prim/scal/meta/include_summand.hpp>
#include <cstdlib>
namespace stan {
namespace math {
template <class RNG>
inline Eigen::VectorXd
multi_student_t_rng(double nu,
const Eigen::Matrix<double, Eigen::Dynamic, 1>& mu,
const Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>& s,
RNG& rng) {
static const char* function("multi_student_t_rng");
check_finite(function, "Location parameter", mu);
check_symmetric(function, "Scale parameter", s);
check_not_nan(function, "Degrees of freedom parameter", nu);
check_positive(function, "Degrees of freedom parameter", nu);
Eigen::VectorXd z(s.cols());
z.setZero();
double w = inv_gamma_rng(nu / 2, nu / 2, rng);
return mu + std::sqrt(w) * multi_normal_rng(z, s, rng);
}
}
}
#endif
check_not_nan.hpp
multiply.hpp
stan::math::check_finite
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
Definition: check_finite.hpp:57
stan::math::sqrt
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:14
check_size_match.hpp
check_positive.hpp
stan
Definition: log_sum_exp.hpp:8
inv_gamma_rng.hpp
check_symmetric.hpp
stan::math::multi_student_t_rng
Eigen::VectorXd multi_student_t_rng(double nu, const Eigen::Matrix< double, Eigen::Dynamic, 1 > &mu, const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > &s, RNG &rng)
Definition: multi_student_t_rng.hpp:27
include_summand.hpp
check_ldlt_factor.hpp
stan::math::check_not_nan
void check_not_nan(const char *function, const char *name, const T_y &y)
Check if y is not NaN.
Definition: check_not_nan.hpp:57
stan::math::inv_gamma_rng
double inv_gamma_rng(double alpha, double beta, RNG &rng)
Definition: inv_gamma_rng.hpp:29
stan::math::check_symmetric
void check_symmetric(const char *function, const char *name, const Eigen::Matrix< T_y, Eigen::Dynamic, Eigen::Dynamic > &y)
Check if the specified matrix is symmetric.
Definition: check_symmetric.hpp:35
multi_normal_rng.hpp
dot_product.hpp
stan::math::multi_normal_rng
Eigen::VectorXd multi_normal_rng(const Eigen::VectorXd &mu, const Eigen::MatrixXd &S, RNG &rng)
Return a pseudo-random vector with a multi-variate normal distribution given the specified location p...
Definition: multi_normal_rng.hpp:35
constants.hpp
check_finite.hpp
log1p.hpp
stan::math::check_positive
void check_positive(const char *function, const char *name, const T_y &y)
Check if y is positive.
Definition: check_positive.hpp:63
subtract.hpp

[ Stan Home Page ] © 2011–2016, Stan Development Team.