1 #ifdef STAN_OPENCL
2 #include <stan/math.hpp>
3 #include <test/unit/math/opencl/util.hpp>
4 #include <test/unit/util.hpp>
5 #include <gtest/gtest.h>
6 
7 auto distance_functor
__anon98ac45280102(const auto& a, const auto& b) 8     = [](const auto& a, const auto& b) { return stan::math::distance(a, b); };
9 
TEST(OpenCLMatrix_distance,prim_rev_values_small)10 TEST(OpenCLMatrix_distance, prim_rev_values_small) {
11   int N = 6;
12 
13   Eigen::VectorXd a(N);
14   a << 1, 2, 3, 4, 5, 6;
15   Eigen::VectorXd b(N);
16   b << 12, 11, 10, 9, 8, 7;
17   stan::math::test::compare_cpu_opencl_prim_rev(distance_functor, a, b);
18 }
19 
TEST(OpenCLMatrix_distance,prim_rev_values_M_0)20 TEST(OpenCLMatrix_distance, prim_rev_values_M_0) {
21   int N = 0;
22 
23   Eigen::VectorXd a(N);
24   Eigen::VectorXd b(N);
25   stan::math::test::compare_cpu_opencl_prim_rev(distance_functor, a, b);
26 }
27 
TEST(OpenCLMatrix_distance,prim_rev_values_large)28 TEST(OpenCLMatrix_distance, prim_rev_values_large) {
29   int N = 71;
30 
31   Eigen::VectorXd a = Eigen::VectorXd::Random(N);
32   Eigen::VectorXd b = Eigen::VectorXd::Random(N);
33   stan::math::test::compare_cpu_opencl_prim_rev(distance_functor, a, b);
34 }
35 
36 #endif
37