C++ (Qt)typedef std::map <double, CMatrix> TMap; const CMatrix * Lookup( TMap & theMap, const CMatrix & m ){ double key = m.Sum(); // сумма всех 16 значений TMap::iterator it = theMap.lower_bound(key - epsilon * 16); if (it == theMap.end()) it = theMap.begin(); while (it != theMap.end()) { if (it.first > key + epsilon * 16) break; if (m == it->second) return &it->second; } return &theMap.insert(std::make_pair(key, m)).first->second;}
bool operator < ( const CMatrix & sec ) const{ return memcmp(m, sec.m, sizeof(m[0]) * 16) < 0;}
bool operator < ( const CMatrix & sec ) const{ for (size_t i = 0; i < 16; ++i) { const double delta = m[i] - sec.m[i]; if (fabs(delta) > epsilon) { return delta < 0.0; } } return false;}