Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
rev
scal
fun
if_else.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_REV_SCAL_FUN_IF_ELSE_HPP
2
#define STAN_MATH_REV_SCAL_FUN_IF_ELSE_HPP
3
4
#include <
stan/math/rev/meta.hpp
>
5
#include <
stan/math/rev/core.hpp
>
6
7
namespace
stan
{
8
namespace
math {
9
18
inline
var
if_else
(
bool
c,
const
var
& y_true,
const
var
& y_false) {
19
return
c ? y_true : y_false;
20
}
30
inline
var
if_else
(
bool
c,
double
y_true,
const
var
& y_false) {
31
if
(c)
32
return
var
(y_true);
33
else
34
return
y_false;
35
}
45
inline
var
if_else
(
bool
c,
const
var
& y_true,
double
y_false) {
46
if
(c)
47
return
y_true;
48
else
49
return
var
(y_false);
50
}
51
52
}
// namespace math
53
}
// namespace stan
54
#endif
core.hpp
stan
Definition:
log_sum_exp.hpp:8
stan::math::var
Independent (input) and dependent (output) variables for gradients.
Definition:
var.hpp:33
stan::math::if_else
boost::math::tools::promote_args< T_true, T_false >::type if_else(const bool c, const T_true y_true, const T_false y_false)
Return the second argument if the first argument is true and otherwise return the second argument...
Definition:
if_else.hpp:25
meta.hpp
[
Stan Home Page
]
© 2011–2018, Stan Development Team.