MCPcopy Create free account
hub / github.com/bgrimstad/splinter / operator<

Method operator<

src/datapoint.cpp:47–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47bool 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||

Callers

nothing calls this directly

Calls 3

getDimXMethod · 0.95
ExceptionClass · 0.85
getXMethod · 0.80

Tested by

no test coverage detected