Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JDistance.hh
Go to the documentation of this file.
1#ifndef __JTOOLS__JDISTANCE__
2#define __JTOOLS__JDISTANCE__
3
4#include <limits>
5
6#include "JLang/JClass.hh"
7
8/**
9 * \author mdejong
10 */
11
12namespace JTOOLS {}
13namespace JPP { using namespace JTOOLS; }
14
15namespace JTOOLS {
16
17 /**
18 * Template class for distance evaluation.
19 *
20 * This class should be specialised for data types when the distance
21 * between two values is not equal to the arithmetic minus operation.
22 */
23 template<class JAbscissa_t>
24 struct JDistance {
25
27
28
29 /**
30 * Get distance between values.
31 *
32 * The distance should be negative, zero or positive if the first value
33 * is respectively larger, equal or smaller compared to the second value.
34 *
35 * \param first first value
36 * \param second second value
37 * \return distance
38 */
39 inline double operator()(argument_type first, argument_type second) const
40 {
41 return second - first;
42 }
43
44 static double precision;
45 };
46
47
48 /**
49 * Default precision.
50 */
51 template<class JAbscissa_t>
52 double JDistance<JAbscissa_t>::precision = std::numeric_limits<double>::min();
53}
54
55#endif
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
JArgument< T >::argument_type argument_type
Definition JClass.hh:82
Template class for distance evaluation.
Definition JDistance.hh:24
static double precision
Default precision.
Definition JDistance.hh:44
double operator()(argument_type first, argument_type second) const
Get distance between values.
Definition JDistance.hh:39
JLANG::JClass< JAbscissa_t >::argument_type argument_type
Definition JDistance.hh:26