#include <DDCompareTools.h>
Public Member Functions | |
DDCompareDBLVEC () | |
DDCompareDBLVEC (double tol) | |
bool | operator() (const std::vector< double > &lhs, const std::vector< double > &rhs) const |
Public Attributes | |
double | tol_ |
Definition at line 60 of file DDCompareTools.h.
DDCompareDBLVEC::DDCompareDBLVEC | ( | ) |
Definition at line 277 of file DDCompareTools.cc.
: tol_(0.0004) { }
DDCompareDBLVEC::DDCompareDBLVEC | ( | double | tol | ) |
Definition at line 279 of file DDCompareTools.cc.
: tol_(tol) { }
bool DDCompareDBLVEC::operator() | ( | const std::vector< double > & | lhs, |
const std::vector< double > & | rhs | ||
) | const |
Definition at line 281 of file DDCompareTools.cc.
References gather_cfg::cout, i, runTheMatrix::ret, and tol_.
{ bool ret(true); if ( lhs.size() != rhs.size() ) { ret = false; std::cout << "Size of vectors do not match." << std::endl; } else { for ( size_t i = 0; i < lhs.size() ; ++i ) { if ( std::fabs( lhs[i] - rhs[i] ) > tol_ ) { ret = false; std::cout << "Vector content at index " << i << " does not match " ; std::cout << std::setw(12) << std::fixed << std::setprecision(4) << lhs[i] << " != " << rhs[i] << std::endl; break; } } } return ret; }
double DDCompareDBLVEC::tol_ |
Definition at line 64 of file DDCompareTools.h.
Referenced by operator()().