Stan Math Library  2.20.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 
6 #include <boost/math/tools/promotion.hpp>
7 #include <cmath>
8 
9 namespace stan {
10 namespace math {
11 
24 template <typename T1, typename T2>
25 inline typename boost::math::tools::promote_args<T1, T2>::type hypot(
26  const T1& x, const T2& y) {
27  using std::sqrt;
28  return sqrt(square(x) + square(y));
29 }
30 
31 } // namespace math
32 } // namespace stan
33 #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:26
fvar< T > sqrt(const fvar< T > &x)
Definition: sqrt.hpp:13
fvar< T > square(const fvar< T > &x)
Definition: square.hpp:12

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