1#ifndef STAN_MATH_PRIM_CONSTRAINT_OFFSET_MULTIPLIER_CONSTRAIN_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_OFFSET_MULTIPLIER_CONSTRAIN_HPP
41template <
typename T,
typename M,
typename S,
46 const auto& mu_ref =
to_ref(mu);
47 const auto& sigma_ref =
to_ref(sigma);
61 return fma(sigma_ref, x, mu_ref);
90template <
typename T,
typename M,
typename S,
95 const auto& mu_ref =
to_ref(mu);
96 const auto& sigma_ref =
to_ref(sigma);
113 lp +=
sum(
log(sigma_ref));
115 return fma(sigma_ref, x, mu_ref);
121template <
typename T,
typename M,
typename S,
128 ret.reserve(x.size());
129 const auto& mu_ref =
to_ref(mu);
130 const auto& sigma_ref =
to_ref(sigma);
131 for (
size_t i = 0; i < x.size(); ++i) {
140template <
typename T,
typename M,
typename S,
148 ret.reserve(x.size());
149 const auto& mu_ref =
to_ref(mu);
150 const auto& sigma_ref =
to_ref(sigma);
151 for (
size_t i = 0; i < x.size(); ++i) {
160template <
typename T,
typename M,
typename S,
163 const std::vector<S>& sigma) {
168 ret.reserve(x.size());
169 const auto& mu_ref =
to_ref(mu);
170 for (
size_t i = 0; i < x.size(); ++i) {
179template <
typename T,
typename M,
typename S,
182 const std::vector<S>& sigma,
188 ret.reserve(x.size());
189 const auto& mu_ref =
to_ref(mu);
190 for (
size_t i = 0; i < x.size(); ++i) {
199template <
typename T,
typename M,
typename S,
202 const std::vector<M>& mu,
208 ret.reserve(x.size());
209 const auto& sigma_ref =
to_ref(sigma);
210 for (
size_t i = 0; i < x.size(); ++i) {
219template <
typename T,
typename M,
typename S,
222 const std::vector<M>& mu,
229 ret.reserve(x.size());
230 const auto& sigma_ref =
to_ref(sigma);
231 for (
size_t i = 0; i < x.size(); ++i) {
240template <
typename T,
typename M,
typename S>
242 const std::vector<M>& mu,
243 const std::vector<S>& sigma) {
249 ret.reserve(x.size());
250 for (
size_t i = 0; i < x.size(); ++i) {
259template <
typename T,
typename M,
typename S>
261 const std::vector<M>& mu,
262 const std::vector<S>& sigma,
269 ret.reserve(x.size());
270 for (
size_t i = 0; i < x.size(); ++i) {
299template <
bool Jacobian,
typename T,
typename M,
typename S>
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.
typename return_type< Ts... >::type return_type_t
Convenience type for the return type of the specified template parameters.
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.
fvar< T > multiply_log(const fvar< T > &x1, const fvar< T > &x2)
fvar< T > log(const fvar< T > &x)
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 ...
ref_type_t< T && > to_ref(T &&a)
This evaluates expensive Eigen expressions.
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.
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< 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...