Automatic Differentiation
 
Loading...
Searching...
No Matches
distance.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_OPENCL_PRIM_DISTANCE_HPP
2#define STAN_MATH_OPENCL_PRIM_DISTANCE_HPP
3#ifdef STAN_OPENCL
4
13#include <algorithm>
14
15namespace stan {
16namespace math {
17
30template <
31 typename T_a, typename T_b,
32 require_all_nonscalar_prim_or_rev_kernel_expression_t<T_a, T_b>* = nullptr>
33inline auto distance(const T_a& a, const T_b& b) {
34 const char* function = "distance (OpenCL)";
35 check_vector(function, "a", a);
36 check_vector(function, "b", b);
37 return sqrt(squared_distance(a, b));
38}
39
40} // namespace math
41} // namespace stan
42#endif
43#endif
auto distance(const T_a &a, const T_b &b)
Returns the distance between the specified vectors.
Definition distance.hpp:33
void check_vector(const char *function, const char *name, const Mat &x)
Check the input is either a row vector or column vector or a matrix with a single row or column.
fvar< T > sqrt(const fvar< T > &x)
Definition sqrt.hpp:17
auto squared_distance(const T_a &a, const T_b &b)
Returns the squared distance.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...