/* ************************************************************************* */ double dot(const Errors& a, const Errors& b) { #ifndef NDEBUG size_t m = a.size(); if (b.size()!=m) throw(std::invalid_argument("Errors::dot: incompatible sizes")); #endif double result = 0.0; Errors::const_iterator it = b.begin(); BOOST_FOREACH(const Vector& ai, a) result += gtsam::dot(ai, *(it++)); return result; }
/* ************************************************************************* */ Errors Errors::operator-(const Errors& b) const { #ifndef NDEBUG size_t m = size(); if (b.size()!=m) throw(std::invalid_argument("Errors::operator-: incompatible sizes")); #endif Errors result; Errors::const_iterator it = b.begin(); BOOST_FOREACH(const Vector& ai, *this) result.push_back(ai - *(it++)); return result; }
bool Errors::equals(const Errors& expected, double tol) const { if( size() != expected.size() ) return false; return equal(begin(),end(),expected.begin(),equalsVector(tol)); }