예제 #1
0
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());
}
예제 #2
0
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);
	}
}