Stan Math Library  2.15.0
reverse mode automatic differentiation
hypot.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_HYPOT_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_HYPOT_HPP
3 
5 #include <boost/math/tools/promotion.hpp>
6 #include <cmath>
7 
8 namespace stan {
9  namespace math {
10 
23  template <typename T1, typename T2>
24  inline typename boost::math::tools::promote_args<T1, T2>::type
25  hypot(const T1& x, const T2& y) {
26  using std::sqrt;
27  return sqrt(x * x + y * y);
28  }
29 
30  }
31 }
32 #endif
fvar< T > hypot(const fvar< T > &x1, const fvar< T > &x2)
Return the length of the hypoteneuse of a right triangle with opposite and adjacent side lengths give...
Definition: hypot.hpp:25
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:14

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