28 BasePrior(param, param.size()), col(param.size())
30 std::vector<std::vector<double>> scale_matrix(param.size(), std::vector<double>(param.size(), 0.));
32 if (options.
hasKey(
"scale_matrix") && options.
hasKey(
"gamma")) {
33 std::stringstream
err;
34 err <<
"Cauchy prior: " 35 <<
"define scale matrix by either 'scale_matrix' or 'gamma'" 39 else if (options.
hasKey(
"scale_matrix"))
41 scale_matrix = options.
getValue<std::vector<std::vector<double>>>(
"scale_matrix");
43 if (scale_matrix.size() != param.size())
45 std::stringstream
err;
46 err <<
"Cauchy prior: " 47 <<
"'scale_matrix' is not the same dimension as the parameters" 52 for (
const auto& row : scale_matrix)
54 if (row.size() != scale_matrix.size())
56 std::stringstream
err;
57 err <<
"Cauchy prior: " 58 <<
"'scale_matrix' is not square" 65 else if (options.
hasKey(
"gamma"))
67 const auto gamma = options.
getVector<
double>(
"gamma");
68 if (gamma.size() != param.size())
70 std::stringstream
err;
71 err <<
"Cauchy prior: " 72 <<
"'gamma' is not the same dimension as the parameters" 78 for (
int i = 0, end = gamma.size(); i < end; i++)
80 scale_matrix[i][i] = gamma[i] * gamma[i];
86 std::stringstream
err;
87 err <<
"Cauchy prior: " 88 <<
"the scale matrix is not defined by either 'scale_matrix' or 'gamma'" 93 if (options.
hasKey(
"location"))
98 std::stringstream
err;
99 err <<
"Cauchy prior: " 100 <<
"'location' vector is not the same dimension as the parameters" 107 std::stringstream
err;
108 err <<
"Cauchy prior: " 109 <<
"'location' vector is required" 116 std::stringstream
err;
117 err <<
"Cauchy prior: " 118 <<
"the scale matrix is not positive-definite" Abstract base class for priors.
bool EnterMat(std::vector< std::vector< double >> &a)
Cauchy(const std::vector< std::string > ¶m, const Options &options)
bool hasKey(const args &... keys) const
Getters for key/value pairs (which is all the options node should contain)
TYPE getValue(const args &... keys) const
std::vector< double > location
std::vector< TYPE > getVector(std::string key) const
Get a std::vector of a particular type.
EXPORT_SYMBOLS error & scan_error()
Scanner errors.
Multivariate Cauchy prior.
TODO: see if we can use this one:
A small wrapper object for 'options' nodes.