Stan  1.3
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
if_else.hpp
Go to the documentation of this file.
1 #ifndef __STAN__AGRAD__REV__IF_ELSE_HPP__
2 #define __STAN__AGRAD__REV__IF_ELSE_HPP__
3 
4 #include <stan/agrad/rev/var.hpp>
5 
6 namespace stan {
7  namespace agrad {
8 
17  inline var if_else(bool c, const var& y_true, const var&y_false) {
18  return c ? y_true : y_false;
19  }
29  inline var if_else(bool c, double y_true, const var& y_false) {
30  if (c)
31  return var(y_true);
32  else
33  return y_false;
34  }
44  inline var if_else(bool c, const var& y_true, const double y_false) {
45  if (c)
46  return y_true;
47  else
48  return var(y_false);
49  }
50 
51  }
52 }
53 #endif

     [ Stan Home Page ] © 2011–2013, Stan Development Team.