1#ifndef STAN_MATH_PRIM_CONSTRAINT_OFFSET_MULTIPLIER_CONSTRAIN_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_OFFSET_MULTIPLIER_CONSTRAIN_HPP
40template <
typename T,
typename M,
typename S,
45 const auto& mu_ref =
to_ref(mu);
46 const auto& sigma_ref =
to_ref(sigma);
90template <
typename T,
typename M,
typename S,
typename Lp,
96 const auto& mu_ref =
to_ref(mu);
97 const auto& sigma_ref =
to_ref(sigma);
114 lp +=
sum(
log(sigma_ref));
122template <
typename T,
typename M,
typename S,
129 ret.reserve(x.size());
130 const auto& mu_ref =
to_ref(mu);
131 const auto& sigma_ref =
to_ref(sigma);
132 for (
size_t i = 0; i < x.size(); ++i) {
141template <
typename T,
typename M,
typename S,
typename Lp,
145 const S& sigma, Lp& lp) {
149 ret.reserve(x.size());
150 const auto& mu_ref =
to_ref(mu);
151 const auto& sigma_ref =
to_ref(sigma);
152 for (
size_t i = 0; i < x.size(); ++i) {
161template <
typename T,
typename M,
typename S,
164 const std::vector<S>& sigma) {
169 ret.reserve(x.size());
170 const auto& mu_ref =
to_ref(mu);
171 for (
size_t i = 0; i < x.size(); ++i) {
180template <
typename T,
typename M,
typename S,
typename Lp,
184 const std::vector<S>& sigma, Lp& lp) {
189 ret.reserve(x.size());
190 const auto& mu_ref =
to_ref(mu);
191 for (
size_t i = 0; i < x.size(); ++i) {
200template <
typename T,
typename M,
typename S,
203 const std::vector<M>& mu,
209 ret.reserve(x.size());
210 const auto& sigma_ref =
to_ref(sigma);
211 for (
size_t i = 0; i < x.size(); ++i) {
220template <
typename T,
typename M,
typename S,
typename Lp,
224 const std::vector<M>& mu,
225 const S& sigma, Lp& lp) {
230 ret.reserve(x.size());
231 const auto& sigma_ref =
to_ref(sigma);
232 for (
size_t i = 0; i < x.size(); ++i) {
241template <
typename T,
typename M,
typename S>
243 const std::vector<M>& mu,
244 const std::vector<S>& sigma) {
250 ret.reserve(x.size());
251 for (
size_t i = 0; i < x.size(); ++i) {
260template <
typename T,
typename M,
typename S,
typename Lp,
263 const std::vector<M>& mu,
264 const std::vector<S>& sigma, Lp& lp) {
270 ret.reserve(x.size());
271 for (
size_t i = 0; i < x.size(); ++i) {
302template <
bool Jacobian,
typename T,
typename M,
typename S,
typename Lp,
305 if constexpr (Jacobian) {
307 std::forward<S>(sigma), lp);
310 std::forward<S>(sigma));
require_t< std::is_convertible< std::decay_t< T >, std::decay_t< S > > > require_convertible_t
Require types T and S satisfies std::is_convertible.
require_all_not_t< is_nonscalar_prim_or_rev_kernel_expression< std::decay_t< Types > >... > require_all_not_nonscalar_prim_or_rev_kernel_expression_t
Require none of the types satisfy is_nonscalar_prim_or_rev_kernel_expression.
require_not_t< is_std_vector< std::decay_t< T > > > require_not_std_vector_t
Require type does not satisfy is_std_vector.
require_all_not_t< is_std_vector< std::decay_t< Types > >... > require_all_not_std_vector_t
Require none of the types satisfy is_std_vector.
int64_t size(const T &m)
Returns the size (number of the elements) of a matrix_cl or var_value<matrix_cl<T>>.
double value_of_rec(const fvar< T > &v)
Return the value of the specified variable.
T eval(T &&arg)
Inputs which have a plain_type equal to the own time are forwarded unmodified (for Eigen expressions ...
fvar< T > log(const fvar< T > &x)
fvar< T > lmultiply(const fvar< T > &x1, const fvar< T > &x2)
void check_matching_dims(const char *function, const char *name1, const T1 &y1, const char *name2, const T2 &y2)
Check if the two containers have the same dimensions.
auto offset_multiplier_constrain(const T &x, const M &mu, const S &sigma)
Return the linearly transformed value for the specified unconstrained input and specified offset and ...
void check_finite(const char *function, const char *name, const T_y &y)
Return true if all values in y are finite.
auto sum(const std::vector< T > &m)
Return the sum of the entries of the specified standard vector.
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
void check_positive_finite(const char *function, const char *name, const T_y &y)
Check if y is positive and finite.
fvar< return_type_t< T1, T2, T3 > > fma(const fvar< T1 > &x1, const fvar< T2 > &x2, const fvar< T3 > &x3)
The fused multiply-add operation (C99).
typename plain_type< std::decay_t< T > >::type plain_type_t
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Check if a type is derived from Eigen::EigenBase or is a var_value whose value_type is derived from E...