-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.h
122 lines (99 loc) · 2.25 KB
/
Point.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#ifndef POINT_H
#define POINT_H
#include "DataTypes.h"
class Point
{
/*!
* The ID of the point.
*/
int ID;
/*!
* The numerical values that define the dimensions of the point.
*/
DoubleVector values;
/*!
* Cluster membership coefficients.
*/
DoubleVector wOld;
/*!
* Cluster membership coefficients.
*/
DoubleVector wNew;
public:
/*!
* Default constructor.
*/
Point();
/*!
* Constructor.
* @param ID the ID of the Point.
* @param k the number of clusters.
*/
Point(int ID, int k);
/*!
* Destructor.
*/
~Point();
/*!
* Sets the ID of the Point.
* @param ID the ID of the Point.
*/
void setID(int ID);
/*!
* Returns the ID of the Point.
* @return the ID of the Point.
*/
int getID() const;
/*!
* Adds a value to the vector of values of the Point.
* @param val the value to be added.
*/
void add(double val);
/*!
* Returns a specific value from the vector of values of the Point.
* @param index the index of the specific value.
* @return the specific value.
*/
double get(size_t index);
/*!
* Returns the size of the vector of values of the Point.
* @return the size of the vector of values of the Point.
*/
size_t size();
/*!
* Update a specific value of the vector of values of the Point.
* @param index the index of the specific value
* @param valNew the new value.
*/
void update(size_t index, double valNew);
/*!
* Returns the vector of values of the Point.
* @return the vector of values of the Point.
*/
DoubleVector* getValues();
/*!
* Updates wNew of the Point.
* @param wNew the new wNew of the Point.
*/
void updateWNew(DoubleVector& wNew);
/*!
* Updates both wOld and wNew of the Point.
*/
void updateW();
/*!
* Compares wOld and wNew of the Point based on their Euclidean distance.
* @param eps the distance threshold under which wOld and wNew are considered equal.
*/
bool compareW(double eps);
/*!
* Returns a specific value of wOld.
* @param clusterID the index for which the value of wOld is requested.
* @return the value of wOld.
*/
double getWOldValue(int clusterID);
/*!
* Prints to the standard output the membership coefficients of the Point.
*/
void printMembershipCoefficients();
};
#endif // POINT_H