MCPcopy Create free account
hub / github.com/davisking/dlib / squared_euclidean_distance

Class squared_euclidean_distance

dlib/graph_utils/function_objects.h:17–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15// ----------------------------------------------------------------------------------------
16
17 struct squared_euclidean_distance
18 {
19 squared_euclidean_distance (
20 ) :
21 lower(0),
22 upper(std::numeric_limits<double>::infinity())
23 {}
24
25 squared_euclidean_distance (
26 const double l,
27 const double u
28 ) :
29 lower(l),
30 upper(u)
31 {}
32
33 const double lower;
34 const double upper;
35
36 template <typename sample_type>
37 double operator() (
38 const sample_type& a,
39 const sample_type& b
40 ) const
41 {
42 const double len = length_squared(a-b);
43 if (lower <= len && len <= upper)
44 return len;
45 else
46 return std::numeric_limits<double>::infinity();
47 }
48 };
49
50// ----------------------------------------------------------------------------------------
51

Callers 6

do_the_testMethod · 0.50
test_knn1Method · 0.50
test_knn1_approxMethod · 0.50
test_knn2Method · 0.50
test_knn2_approxMethod · 0.50

Calls

no outgoing calls

Tested by 6

do_the_testMethod · 0.40
test_knn1Method · 0.40
test_knn1_approxMethod · 0.40
test_knn2Method · 0.40
test_knn2_approxMethod · 0.40