22 return (a <= b+epsilon) && (a >= b-epsilon);
26 bool approxEqual(
const MatrixWrapper::Matrix& a,
const MatrixWrapper::Matrix& b,
double epsilon)
28 if (a.rows() != b.rows())
return false;
29 if (a.columns() != b.columns())
return false;
31 for (
unsigned int r=0; r<a.rows(); r++)
32 for (
unsigned int c=0; c<a.columns(); c++)
33 if (!
approxEqual(a(r+1, c+1), b(r+1,c+1),epsilon))
return false;
39 bool approxEqual(
const MatrixWrapper::SymmetricMatrix& a,
const MatrixWrapper::SymmetricMatrix& b,
double epsilon)
41 if (a.rows() != b.rows())
return false;
42 if (a.columns() != b.columns())
return false;
44 for (
unsigned int r=0; r<a.rows(); r++)
45 for (
unsigned int c=0; c<a.columns(); c++)
46 if (!
approxEqual(a(r+1, c+1), b(r+1,c+1),epsilon))
return false;
51 bool approxEqual(
const MatrixWrapper::ColumnVector& a,
const MatrixWrapper::ColumnVector& b,
double epsilon)
53 if (a.rows() != b.rows())
return false;
55 for (
unsigned int r=0; r<a.rows(); r++)
56 if (!
approxEqual(a(r+1), b(r+1),epsilon))
return false;
bool approxEqual(double a, double b, double epsilon)