Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
divide.hpp
Go to the documentation of this file.
1 #ifndef STAN__AGRAD__REV__MATRIX__DIVIDE_HPP
2 #define STAN__AGRAD__REV__MATRIX__DIVIDE_HPP
3 
4 #include <vector>
7 #include <stan/agrad/rev/var.hpp>
11 
12 namespace stan {
13  namespace agrad {
14 
22  inline double
23  divide(double x, double y) {
24  return x / y;
25  }
26  template <typename T1, typename T2>
27  inline var
28  divide(const T1& v, const T2& c) {
29  return to_var(v) / to_var(c);
30  }
38  template <typename T1, typename T2, int R, int C>
39  inline Eigen::Matrix<var,R,C>
40  divide(const Eigen::Matrix<T1, R,C>& v, const T2& c) {
41  return to_var(v) / to_var(c);
42  }
43 
44  }
45 }
46 #endif
var to_var(const double &x)
Converts argument to an automatic differentiation variable.
Definition: to_var.hpp:21
stan::return_type< T1, T2 >::type divide(const T1 &v, const T2 &c)
Definition: divide.hpp:17

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