13 #ifndef eli_util_tolerance_hpp
14 #define eli_util_tolerance_hpp
19 #include "eli/code_eli.hpp"
25 template<
typename data__>
70 template<
typename Derived1,
typename Derived2>
71 bool exactly_equal(
const Eigen::MatrixBase<Derived1> &m1,
const Eigen::MatrixBase<Derived2> &m2)
const
73 if (m1.rows()!=m2.rows())
75 if (m1.cols()!=m2.cols())
86 template<
typename type2__>
89 return (t1==static_cast<data__>(t2));
92 template<
typename type1__>
98 template<
typename Derived1,
typename Derived2>
99 bool approximately_equal(
const Eigen::MatrixBase<Derived1> &m1,
const Eigen::MatrixBase<Derived2> &m2)
const
101 typename Derived1::Index i, j;
103 if (m1.rows()!=m2.rows())
105 if (m1.cols()!=m2.cols())
108 for (i=0; i<m1.rows(); ++i)
110 for (j=0; j<m1.cols(); ++j)
122 data__ diff(std::abs(t1-t2));
128 data__ denom(std::max(std::abs(t1), std::abs(t2)));
137 template<
typename type2__>
140 data__ t2=
static_cast<data__
>(ti2);
145 template<
typename type1__>
159 template<
typename type2__>
165 data__ t2=
static_cast<data__
>(ti2);
169 template<
typename type1__>
175 data__ t1=
static_cast<data__
>(ti1);
tolerance(const tolerance< data__ > &tol)
Definition: tolerance.hpp:34
bool approximately_equal(const data__ &t1, const data__ &t2) const
Definition: tolerance.hpp:120
tolerance(const data__ &abs, const data__ &rel)
Definition: tolerance.hpp:33
bool approximately_less_than(const type1__ &ti1, const data__ &t2) const
Definition: tolerance.hpp:170
bool approximately_equal(const Eigen::MatrixBase< Derived1 > &m1, const Eigen::MatrixBase< Derived2 > &m2) const
Definition: tolerance.hpp:99
data__ rel_tol
Definition: tolerance.hpp:181
bool approximately_less_than(const data__ &t1, const type2__ &ti2) const
Definition: tolerance.hpp:160
data__ get_absolute_tolerance() const
Definition: tolerance.hpp:68
~tolerance()
Definition: tolerance.hpp:35
bool approximately_less_than(const data__ &t1, const data__ &t2) const
Definition: tolerance.hpp:151
Definition: tolerance.hpp:26
bool approximately_equal(const data__ &t1, const type2__ &ti2) const
Definition: tolerance.hpp:138
bool operator==(const tolerance< data__ > &tol) const
Definition: tolerance.hpp:48
bool exactly_equal(const data__ &t1, const type2__ &t2) const
Definition: tolerance.hpp:87
data__ abs_tol
Definition: tolerance.hpp:180
bool approximately_equal(const type1__ &ti1, const data__ &t2) const
Definition: tolerance.hpp:146
bool exactly_equal(const Eigen::MatrixBase< Derived1 > &m1, const Eigen::MatrixBase< Derived2 > &m2) const
Definition: tolerance.hpp:71
tolerance & operator=(const tolerance< data__ > &tol)
Definition: tolerance.hpp:37
bool exactly_equal(const type1__ &t1, const data__ &t2) const
Definition: tolerance.hpp:93
bool exactly_equal(const data__ &t1, const data__ &t2) const
Definition: tolerance.hpp:81
tolerance()
Definition: tolerance.hpp:29
bool operator!=(const tolerance< data__ > &tol) const
Definition: tolerance.hpp:62
data__ get_relative_tolerance() const
Definition: tolerance.hpp:67