1#ifndef STAN_MATH_PRIM_CONSTRAINT_OFFSET_MULTIPLIER_CONSTRAIN_HPP
2#define STAN_MATH_PRIM_CONSTRAINT_OFFSET_MULTIPLIER_CONSTRAIN_HPP
42template <
typename T,
typename M,
typename S,
47 const auto& mu_ref =
to_ref(mu);
48 const auto& sigma_ref =
to_ref(sigma);
92template <
typename T,
typename M,
typename S,
typename Lp,
98 const auto& mu_ref =
to_ref(mu);
99 const auto& sigma_ref =
to_ref(sigma);
116 lp +=
sum(
log(sigma_ref));
124template <
typename T,
typename M,
typename S,
131 ret.reserve(x.size());
132 const auto& mu_ref =
to_ref(mu);
133 const auto& sigma_ref =
to_ref(sigma);
134 for (
size_t i = 0; i < x.size(); ++i) {
143template <
typename T,
typename M,
typename S,
typename Lp,
147 const S& sigma, Lp& lp) {
151 ret.reserve(x.size());
152 const auto& mu_ref =
to_ref(mu);
153 const auto& sigma_ref =
to_ref(sigma);
154 for (
size_t i = 0; i < x.size(); ++i) {
163template <
typename T,
typename M,
typename S,
166 const std::vector<S>& sigma) {
171 ret.reserve(x.size());
172 const auto& mu_ref =
to_ref(mu);
173 for (
size_t i = 0; i < x.size(); ++i) {
182template <
typename T,
typename M,
typename S,
typename Lp,
186 const std::vector<S>& sigma, Lp& lp) {
191 ret.reserve(x.size());
192 const auto& mu_ref =
to_ref(mu);
193 for (
size_t i = 0; i < x.size(); ++i) {
202template <
typename T,
typename M,
typename S,
205 const std::vector<M>& mu,
211 ret.reserve(x.size());
212 const auto& sigma_ref =
to_ref(sigma);
213 for (
size_t i = 0; i < x.size(); ++i) {
222template <
typename T,
typename M,
typename S,
typename Lp,
226 const std::vector<M>& mu,
227 const S& sigma, Lp& lp) {
232 ret.reserve(x.size());
233 const auto& sigma_ref =
to_ref(sigma);
234 for (
size_t i = 0; i < x.size(); ++i) {
243template <
typename T,
typename M,
typename S>
245 const std::vector<M>& mu,
246 const std::vector<S>& sigma) {
252 ret.reserve(x.size());
253 for (
size_t i = 0; i < x.size(); ++i) {
262template <
typename T,
typename M,
typename S,
typename Lp,
265 const std::vector<M>& mu,
266 const std::vector<S>& sigma, Lp& lp) {
272 ret.reserve(x.size());
273 for (
size_t i = 0; i < x.size(); ++i) {
304template <
bool Jacobian,
typename T,
typename M,
typename S,
typename Lp,
308 if constexpr (Jacobian) {
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.
fvar< T > multiply_log(const fvar< T > &x1, const fvar< T > &x2)
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)
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...