Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
prim
scal
fun
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
4
#include <
stan/math/prim/meta.hpp
>
5
#include <
stan/math/prim/scal/err/check_finite.hpp
>
6
#include <
stan/math/prim/scal/fun/abs.hpp
>
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
stan::math::abs
fvar< T > abs(const fvar< T > &x)
Definition:
abs.hpp:14
stan::math::check_finite
void check_finite(const char *function, const char *name, const T_y &y)
Check if y is finite.
Definition:
check_finite.hpp:44
stan
Definition:
log_sum_exp.hpp:8
meta.hpp
abs.hpp
check_finite.hpp
stan::return_type::type
boost::math::tools::promote_args< double, typename scalar_type< T >::type, typename return_type< Types_pack... >::type >::type type
Definition:
return_type.hpp:36
stan::math::distance
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.