-
Notifications
You must be signed in to change notification settings - Fork 1
/
DistanceMethod.h
69 lines (58 loc) · 2.1 KB
/
DistanceMethod.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef DISTANCEMETHOD_H
#define DISTANCEMETHOD_H
#include <string>
#include <vector>
#include "MethodsList.h"
#include "Structure.h"
#include "StructureList.h"
namespace cfp_internal
{
class DistanceMethod
{
public:
DistanceMethod()
{
};
std::string getName(void) const { return mName; }
virtual ~DistanceMethod() {};
virtual float computeDistance(const Structure& aStructure1, const Structure& aStructure2) const =0;
protected:
std::string mName;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class CosineDistance : public DistanceMethod
{
public:
CosineDistance() {mName = "Cosine distance";}
virtual float computeDistance(const Structure& aStructure1, const Structure& aStructure2) const;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class EuclideanDistance : public DistanceMethod
{
public:
EuclideanDistance() {mName = "Euclidean distance";}
virtual float computeDistance(const Structure& aStructure1, const Structure& aStructure2) const;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class MinkowskiDistance : public DistanceMethod
{
public:
MinkowskiDistance() {mName = "Minkowski (p=1/3) distance";}
virtual float computeDistance(const Structure& aStructure1, const Structure& aStructure2) const;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class DistanceMethodsList : public MethodsList<DistanceMethod>
{
public:
DistanceMethodsList()
{
mMethodsList.push_back(new CosineDistance);
mMethodsList.push_back(new EuclideanDistance);
mMethodsList.push_back(new MinkowskiDistance);
}
~DistanceMethodsList() {clear();}
};
}
#endif