Macaulay2 Engine
Loading...
Searching...
No Matches

◆ lookup_or_append()

int PointArray::lookup_or_append ( const RealVector & a)
inline

Definition at line 134 of file NAG.hpp.

135 {
136 Weight w = weight(a);
137 int p = lookup(a);
138 if (p != -1) return p;
139 if (mMap.find(w) != mMap.end()) return -1;
140 int ret = static_cast<int>(mPoints.size());
141 mPoints.push_back(a);
142 mMap.insert(std::pair<Weight, int>(w, ret));
143 return ret;
144 }
std::vector< RealVector > mPoints
Definition NAG.hpp:179
int lookup(const RealVector &a) const
Definition NAG.hpp:145
double Weight
Definition NAG.hpp:115
Weight weight(const RealVector &a) const
Definition NAG.hpp:154
std::map< Weight, int > mMap
Definition NAG.hpp:178
int p

References lookup(), mMap, mPoints, p, and weight().

Referenced by rawPointArrayLookupOrAppend(), and TEST().