Stan Math Library  2.20.0
reverse mode automatic differentiation
distance.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_DISTANCE_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_DISTANCE_HPP
3 
7 
8 namespace stan {
9 namespace math {
10 
19 template <typename T1, typename T2>
20 inline typename return_type<T1, T2>::type distance(const T1& x1, const T2& x2) {
21  check_finite("distance", "x1", x1);
22  check_finite("distance", "x2", x2);
23  return abs(x1 - x2);
24 }
25 } // namespace math
26 } // namespace stan
27 #endif
fvar< T > abs(const fvar< T > &x)
Definition: abs.hpp:14
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
boost::math::tools::promote_args< double, typename scalar_type< T >::type, typename return_type< Types_pack... >::type >::type type
Definition: return_type.hpp:36
boost::math::tools::promote_args< T1, T2 >::type distance(const Eigen::Matrix< T1, R1, C1 > &v1, const Eigen::Matrix< T2, R2, C2 > &v2)
Returns the distance between the specified vectors.
Definition: distance.hpp:23

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