| 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 |
no outgoing calls