1#ifndef STAN_MATH_PRIM_CONSTRAINT_ORDERED_FREE_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_ORDERED_FREE_HPP
27template <
typename EigVec, require_eigen_col_vector_t<EigVec>* =
nullptr>
29 const auto& y_ref =
to_ref(y);
30 check_ordered(
"stan::math::ordered_free",
"Ordered variable", y_ref);
32 Eigen::Index k = y.size();
38 for (Eigen::Index i = 1; i < k; ++i) {
39 x.coeffRef(i) =
log(y_ref.coeff(i) - y_ref.coeff(i - 1));
51template <
typename T, require_std_vector_t<T>* =
nullptr>
fvar< T > log(const fvar< T > &x)
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
plain_type_t< EigVec > ordered_free(const EigVec &y)
Return the vector of unconstrained scalars that transform to the specified positive ordered vector.
void check_ordered(const char *function, const char *name, const T_y &y)
Throw an exception if the specified vector is not sorted into strictly increasing order.
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...