Stan Math Library
2.11.0
reverse mode automatic differentiation
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
stan
math
prim
scal
fun
squared_distance.hpp
Go to the documentation of this file.
1
#ifndef STAN_MATH_PRIM_SCAL_FUN_SQUARED_DISTANCE_HPP
2
#define STAN_MATH_PRIM_SCAL_FUN_SQUARED_DISTANCE_HPP
3
4
#include <
stan/math/prim/scal/err/check_finite.hpp
>
5
#include <
stan/math/prim/scal/fun/square.hpp
>
6
7
namespace
stan
{
8
namespace
math {
9
19
template
<
typename
T1,
typename
T2>
20
inline
typename
boost::math::tools::promote_args<T1, T2>::type
21
squared_distance
(
const
T1& x1,
22
const
T2& x2) {
23
check_finite
(
"squared_distance"
,
"x1"
, x1);
24
check_finite
(
"squared_distance"
,
"x2"
, x2);
25
return
square
(x1 - x2);
26
}
27
}
28
}
29
#endif
stan
Definition:
log_sum_exp.hpp:8
square.hpp
stan::math::squared_distance
stan::math::fvar< T > squared_distance(const Eigen::Matrix< stan::math::fvar< T >, R, C > &v1, const Eigen::Matrix< double, R, C > &v2)
Returns the squared distance between the specified vectors of the same dimensions.
Definition:
squared_distance.hpp:30
stan::math::square
fvar< T > square(const fvar< T > &x)
Definition:
square.hpp:15
stan::math::check_finite
bool check_finite(const char *function, const char *name, const T_y &y)
Return true if y is finite.
Definition:
check_finite.hpp:62
check_finite.hpp
[
Stan Home Page
]
© 2011–2016, Stan Development Team.