bool operator<(GeneralOp const &o) const { if (op.size() < o.op.size()) return true; if (op.size() > o.op.size()) return false; for (unsigned int i = 0; i < op.size(); ++i) { if (op[i] < o.op[i]) return true; if (o.op[i] < op[i]) return false; } return false; }
void checkDenseExpressionEquality( Operation op, Result const& result ){ BOOST_REQUIRE_EQUAL(op.size(), result.size()); typename Operation::const_iterator pos = op.begin(); for(std::size_t i = 0; i != op.size(); ++i,++pos){ BOOST_REQUIRE(pos != op.end()); BOOST_CHECK_EQUAL(pos.index(), i); BOOST_CHECK_CLOSE(result(i), op(i),1.e-10); BOOST_CHECK_CLOSE(*pos, op(i),1.e-10); } BOOST_REQUIRE(pos == op.end()); }
void checkSparseExpressionEquality( Operation op, Result const& result ){ BOOST_CHECK_EQUAL(op.size(), result.size()); typename Operation::const_iterator posOp = op.begin(); typename Result::const_iterator posResult = result.begin(); for(;posResult != result.end();++posOp,++posResult){ BOOST_REQUIRE(posOp != op.end()); BOOST_REQUIRE_EQUAL(posOp.index(), posResult.index()); BOOST_CHECK_SMALL(*posOp-*posResult,1.e-3); } }