9 template <
class NUMBER,
class PREC>
10 inline bool numbers_are_equal(
const NUMBER& a_left,
const NUMBER& a_right,
const PREC& a_prec,PREC(*a_fabs)(
const NUMBER&)) {
11 NUMBER
diff = a_left - a_right;
12 if(a_fabs(
diff)>=a_prec)
return false;
16 template <
class NUMBER,
class PREC>
17 inline bool is_zero(
const NUMBER& a_left,
const PREC& a_prec,PREC(*a_fabs)(
const NUMBER&)) {
18 if(a_fabs(a_left)>=a_prec)
return false;
22 template <
class VEC,
class PREC>
23 inline bool vectors_are_equal(
const VEC& a_1,
const VEC& a_2,
const PREC& a_prec,PREC(*a_fabs)(
const PREC&)) {
24 if(a_1.size()!=a_2.size())
return false;
25 typedef typename VEC::size_type sz_t;
28 for(sz_t index=0;index<sz;index++) {
39 template <
class VECVEC,
class PREC>
40 inline bool vecvecs_are_equal(
const VECVEC& a_1,
const VECVEC& a_2,
const PREC& a_prec,PREC(*a_fabs)(
const PREC&)) {
41 if(a_1.size()!=a_2.size())
return false;
42 typedef typename VECVEC::size_type sz_t;
44 for(sz_t index=0;index<sz;index++) {
56 template <
class NUMBER,
class PREC>
57 inline bool numbers_are_equal(
const NUMBER& a_left,
const NUMBER& a_right,
const PREC& a_prec,PREC(*a_fabs)(NUMBER)) {
58 NUMBER
diff = a_left - a_right;
59 if(a_fabs(
diff)>=a_prec)
return false;
63 template <
class VEC,
class PREC>
64 inline bool vectors_are_equal(
const VEC& a_1,
const VEC& a_2,
const PREC& a_prec,PREC(*a_fabs)(PREC)) {
65 if(a_1.size()!=a_2.size())
return false;
66 typedef typename VEC::size_type sz_t;
69 for(sz_t index=0;index<sz;index++) {
80 template <
class VECVEC,
class PREC>
81 inline bool vecvecs_are_equal(
const VECVEC& a_1,
const VECVEC& a_2,
const PREC& a_prec,PREC(*a_fabs)(PREC)) {
82 if(a_1.size()!=a_2.size())
return false;
83 typedef typename VECVEC::size_type sz_t;
85 for(sz_t index=0;index<sz;index++) {