1#ifndef STAN_MATH_PRIM_CONSTRAINT_UNIT_VECTOR_CONSTRAIN_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_UNIT_VECTOR_CONSTRAIN_HPP
25template <
typename T, require_eigen_col_vector_t<T>* =
nullptr,
26 require_not_vt_autodiff<T>* =
nullptr>
33 return y_ref.array() /
sqrt(SN);
47template <
typename T1,
typename T2, require_eigen_col_vector_t<T1>* =
nullptr,
48 require_all_not_vt_autodiff<T1, T2>* =
nullptr>
56 return y_ref.array() /
sqrt(SN);
75template <
bool Jacobian,
typename T, require_not_std_vector_t<T>* =
nullptr>
100template <
bool Jacobian,
typename T, require_std_vector_t<T>* =
nullptr>
102 return apply_vector_unary<T>::apply(
103 y, [&lp](
auto&& v) {
return unit_vector_constrain<Jacobian>(v, lp); });
typename value_type< T >::type value_type_t
Helper function for accessing underlying type.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
auto unit_vector_constrain(const EigMat &y)
fvar< T > sqrt(const fvar< T > &x)
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
void check_nonzero_size(const char *function, const char *name, const T_y &y)
Check if the specified matrix/vector is of non-zero size.
auto dot_self(const T &a)
Returns squared norm of a vector or matrix.
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
typename plain_type< T >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...