/* ************************************************************************* */ 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; }
/* ************************************************************************* */ void GaussianFactorGraph::multiplyInPlace(const VectorValues& x, Errors& e) const { multiplyInPlace(x, e.begin()); }
bool Errors::equals(const Errors& expected, double tol) const { if( size() != expected.size() ) return false; return equal(begin(),end(),expected.begin(),equalsVector(tol)); }
void axpy<Errors,Errors>(double alpha, const Errors& x, Errors& y) { Errors::const_iterator it = x.begin(); BOOST_FOREACH(Vector& yi, y) axpy(alpha,*(it++),yi); }