Loading [MathJax]/extensions/TeX/AMSsymbols.js
Automatic Differentiation
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
hypot.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_HYPOT_HPP
2#define STAN_MATH_PRIM_FUN_HYPOT_HPP
3
6#include <cmath>
7
8namespace stan {
9namespace math {
10
23template <typename T1, typename T2, require_all_arithmetic_t<T1, T2>* = nullptr>
24inline double hypot(T1 x, T2 y) {
25 using std::hypot;
26 return hypot(x, y);
27}
28
39template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
40 require_all_not_nonscalar_prim_or_rev_kernel_expression_t<
41 T1, T2>* = nullptr>
42inline auto hypot(const T1& a, const T2& b) {
44 [](const auto& c, const auto& d) { return hypot(c, d); }, a, b);
45}
46
47} // namespace math
48} // namespace stan
49#endif
fvar< T > hypot(const fvar< T > &x1, const fvar< T > &x2)
Return the length of the hypotenuse of a right triangle with opposite and adjacent side lengths given...
Definition hypot.hpp:26
auto apply_scalar_binary(const F &f, const T1 &x, const T2 &y)
Base template function for vectorization of binary scalar functions defined by applying a functor to ...
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...