bool equal(boost::numeric::ublas::matrix<E> lhs, boost::numeric::ublas::matrix<E> rhs) { if (&lhs == &rhs) { return true; } if (lhs.size1() != rhs.size1()) { return false; } if (lhs.size2() != rhs.size2()) { return false; } typename boost::numeric::ublas::matrix<E>::iterator1 l(lhs.begin1()); typename boost::numeric::ublas::matrix<E>::iterator1 r(rhs.begin1()); while (l != lhs.end1()) { if (*l != *r) { return false; } ++l; ++r; } return true; }
inline void for_each(boost::numeric::ublas::matrix<T> & mat, Fun f){ for(auto it1 = mat.begin1(); it1 < mat.end1(); ++it1){ for(auto it = it1.begin(); it < it1.end(); ++it){ f(*it); } } }