Stan Math Library
5.0.0
Automatic Differentiation
Loading...
Searching...
No Matches
if_else.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_REV_FUN_IF_ELSE_HPP
2
#define STAN_MATH_REV_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
}
36
}
46
inline
var
if_else
(
bool
c,
const
var
& y_true,
double
y_false) {
47
if
(c) {
48
return
y_true;
49
}
else
{
50
return
var
(y_false);
51
}
52
}
53
54
}
// namespace math
55
}
// namespace stan
56
#endif
stan::math::var_value< double >
stan::math::if_else
return_type_t< T_true, T_false > 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:26
stan::math::var
var_value< double > var
Definition
var.hpp:1187
stan
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition
unit_vector_constrain.hpp:15
core.hpp
meta.hpp
stan
math
rev
fun
if_else.hpp
[
Stan Home Page
]
© 2011–2019, Stan Development Team.