1 #ifndef STAN_MATH_PRIM_MAT_FUN_SIMPLEX_FREE_HPP 2 #define STAN_MATH_PRIM_MAT_FUN_SIMPLEX_FREE_HPP 29 const Eigen::Matrix<T, Eigen::Dynamic, 1>& x) {
36 check_simplex(
"stan::math::simplex_free",
"Simplex variable", x);
37 int Km1 = x.size() - 1;
38 Eigen::Matrix<T, Eigen::Dynamic, 1> y(Km1);
40 for (size_type k = Km1; --k >= 0;) {
42 T z_k(x(k) / stick_len);
void check_simplex(const char *function, const char *name, const Eigen::Matrix< T_prob, Eigen::Dynamic, 1 > &theta)
Check if the specified vector is simplex.
fvar< T > log(const fvar< T > &x)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic >::Index size_type
Type for sizes and indexes in an Eigen matrix with double e.
Primary template class for the metaprogram to compute the index type of a container.
fvar< T > logit(const fvar< T > &x)
Eigen::Matrix< T, Eigen::Dynamic, 1 > simplex_free(const Eigen::Matrix< T, Eigen::Dynamic, 1 > &x)
Return an unconstrained vector that when transformed produces the specified simplex.