Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "approxEqual.hpp"
00019
00020 bool approxEqual(double a, double b, double epsilon)
00021 {
00022 return (a <= b+epsilon) && (a >= b-epsilon);
00023 }
00024
00025
00026 bool approxEqual(const MatrixWrapper::Matrix& a, const MatrixWrapper::Matrix& b, double epsilon)
00027 {
00028 if (a.rows() != b.rows()) return false;
00029 if (a.columns() != b.columns()) return false;
00030
00031 for (unsigned int r=0; r<a.rows(); r++)
00032 for (unsigned int c=0; c<a.columns(); c++)
00033 if (!approxEqual(a(r+1, c+1), b(r+1,c+1),epsilon)) return false;
00034
00035 return true;
00036 }
00037
00038
00039 bool approxEqual(const MatrixWrapper::SymmetricMatrix& a, const MatrixWrapper::SymmetricMatrix& b, double epsilon)
00040 {
00041 if (a.rows() != b.rows()) return false;
00042 if (a.columns() != b.columns()) return false;
00043
00044 for (unsigned int r=0; r<a.rows(); r++)
00045 for (unsigned int c=0; c<a.columns(); c++)
00046 if (!approxEqual(a(r+1, c+1), b(r+1,c+1),epsilon)) return false;
00047
00048 return true;
00049 }
00050
00051 bool approxEqual(const MatrixWrapper::ColumnVector& a, const MatrixWrapper::ColumnVector& b, double epsilon)
00052 {
00053 if (a.rows() != b.rows()) return false;
00054
00055 for (unsigned int r=0; r<a.rows(); r++)
00056 if (!approxEqual(a(r+1), b(r+1),epsilon)) return false;
00057
00058 return true;
00059 }
bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Sun Oct 5 2014 22:29:52