class ManhattanMetric
The Manhattan distance (city block distance, norm, rectilinear distance or taxi cab metric ) is a special case of general Minkowski metric and computes the absolute differences between the feature dimensions of two data points.
Definition at line 36 of file ManhattanMetric.h.
Public Member Functions | |
CManhattanMetric () | |
CManhattanMetric (CSimpleFeatures< float64_t > *l, CSimpleFeatures< float64_t > *r) | |
virtual | ~CManhattanMetric () |
virtual bool | init (CFeatures *l, CFeatures *r) |
virtual void | cleanup () |
virtual EDistanceType | get_distance_type () |
virtual const char * | get_name () const |
Protected Member Functions | |
virtual float64_t | compute (int32_t idx_a, int32_t idx_b) |
CManhattanMetric | ( | ) |
default constructor
Definition at line 20 of file ManhattanMetric.cpp.
CManhattanMetric | ( | CSimpleFeatures< float64_t > * | l, | |
CSimpleFeatures< float64_t > * | r | |||
) |
constructor
l | features of left-hand side | |
r | features of right-hand side |
Definition at line 25 of file ManhattanMetric.cpp.
~CManhattanMetric | ( | ) | [virtual] |
Definition at line 31 of file ManhattanMetric.cpp.
void cleanup | ( | ) | [virtual] |
cleanup distance
Implements CSimpleDistance< float64_t >.
Definition at line 43 of file ManhattanMetric.cpp.
float64_t compute | ( | int32_t | idx_a, | |
int32_t | idx_b | |||
) | [protected, virtual] |
compute distance for features a and b idx_{a,b} denote the index of the feature vectors in the corresponding feature object
Implements CDistance.
Definition at line 47 of file ManhattanMetric.cpp.
virtual EDistanceType get_distance_type | ( | ) | [virtual] |
get distance type we are
Implements CSimpleDistance< float64_t >.
Definition at line 65 of file ManhattanMetric.h.
virtual const char* get_name | ( | ) | const [virtual] |
get name of the distance
Reimplemented from CSimpleDistance< float64_t >.
Definition at line 71 of file ManhattanMetric.h.
init distance
l | features of left-hand side | |
r | features of right-hand side |
Reimplemented from CSimpleDistance< float64_t >.
Definition at line 36 of file ManhattanMetric.cpp.