| 45 | } |
| 46 | |
| 47 | bool DataPoint::operator<(const DataPoint &rhs) const |
| 48 | { |
| 49 | if (this->getDimX() != rhs.getDimX()) |
| 50 | throw Exception("DataPoint::operator<: Cannot compare data points of different dimensions"); |
| 51 | |
| 52 | for (unsigned int i = 0; i < this->getDimX(); i++) |
| 53 | { |
| 54 | if (x.at(i) < rhs.getX().at(i)) |
| 55 | return true; |
| 56 | else if (x.at(i) > rhs.getX().at(i)) |
| 57 | return false; |
| 58 | } |
| 59 | |
| 60 | return false; |
| 61 | } |
| 62 | |
| 63 | /* |
| 64 | * Computes Euclidean distance ||x-y|| |