equal
deleted
inserted
replaced
38 /// |
38 /// |
39 ///\ref Tolerance is a class to provide a basic way to |
39 ///\ref Tolerance is a class to provide a basic way to |
40 ///handle the comparison of numbers that are obtained |
40 ///handle the comparison of numbers that are obtained |
41 ///as a result of a probably inexact computation. |
41 ///as a result of a probably inexact computation. |
42 /// |
42 /// |
43 ///This is an abstract class, it should be specialized for all numerical |
43 ///This is an abstract class, it should be specialized for all |
44 ///data types. These specialized classes like \ref Tolerance<double> |
44 ///numerical data types. These specialized classes like |
45 ///may offer additional tuning parameters. |
45 ///Tolerance<double> may offer additional tuning parameters. |
46 /// |
46 /// |
47 ///\sa Tolerance<float> |
47 ///\sa Tolerance<float> |
48 ///\sa Tolerance<double> |
48 ///\sa Tolerance<double> |
49 ///\sa Tolerance<long double> |
49 ///\sa Tolerance<long double> |
50 ///\sa Tolerance<int> |
50 ///\sa Tolerance<int> |
115 static Value defaultEpsilon() {return def_epsilon;} |
115 static Value defaultEpsilon() {return def_epsilon;} |
116 ///Sets the default epsilon value. |
116 ///Sets the default epsilon value. |
117 static void defaultEpsilon(Value e) {def_epsilon=e;} |
117 static void defaultEpsilon(Value e) {def_epsilon=e;} |
118 |
118 |
119 ///\name Comparisons |
119 ///\name Comparisons |
120 ///See \ref Tolerance for more details. |
120 ///See \ref lemon::Tolerance "Tolerance" for more details. |
121 |
121 |
122 ///@{ |
122 ///@{ |
123 |
123 |
124 ///Returns \c true if \c a is \e surely strictly less than \c b |
124 ///Returns \c true if \c a is \e surely strictly less than \c b |
125 bool less(Value a,Value b) const {return a+_epsilon<b;} |
125 bool less(Value a,Value b) const {return a+_epsilon<b;} |
166 static Value defaultEpsilon() {return def_epsilon;} |
166 static Value defaultEpsilon() {return def_epsilon;} |
167 ///Sets the default epsilon value. |
167 ///Sets the default epsilon value. |
168 static void defaultEpsilon(Value e) {def_epsilon=e;} |
168 static void defaultEpsilon(Value e) {def_epsilon=e;} |
169 |
169 |
170 ///\name Comparisons |
170 ///\name Comparisons |
171 ///See \ref Tolerance for more details. |
171 ///See \ref lemon::Tolerance "Tolerance" for more details. |
172 |
172 |
173 ///@{ |
173 ///@{ |
174 |
174 |
175 ///Returns \c true if \c a is \e surely strictly less than \c b |
175 ///Returns \c true if \c a is \e surely strictly less than \c b |
176 bool less(Value a,Value b) const {return a+_epsilon<b;} |
176 bool less(Value a,Value b) const {return a+_epsilon<b;} |
217 static Value defaultEpsilon() {return def_epsilon;} |
217 static Value defaultEpsilon() {return def_epsilon;} |
218 ///Sets the default epsilon value. |
218 ///Sets the default epsilon value. |
219 static void defaultEpsilon(Value e) {def_epsilon=e;} |
219 static void defaultEpsilon(Value e) {def_epsilon=e;} |
220 |
220 |
221 ///\name Comparisons |
221 ///\name Comparisons |
222 ///See \ref Tolerance for more details. |
222 ///See \ref lemon::Tolerance "Tolerance" for more details. |
223 |
223 |
224 ///@{ |
224 ///@{ |
225 |
225 |
226 ///Returns \c true if \c a is \e surely strictly less than \c b |
226 ///Returns \c true if \c a is \e surely strictly less than \c b |
227 bool less(Value a,Value b) const {return a+_epsilon<b;} |
227 bool less(Value a,Value b) const {return a+_epsilon<b;} |
250 public: |
250 public: |
251 ///\e |
251 ///\e |
252 typedef int Value; |
252 typedef int Value; |
253 |
253 |
254 ///\name Comparisons |
254 ///\name Comparisons |
255 ///See \ref Tolerance for more details. |
255 ///See \ref lemon::Tolerance "Tolerance" for more details. |
256 |
256 |
257 ///@{ |
257 ///@{ |
258 |
258 |
259 ///Returns \c true if \c a is \e surely strictly less than \c b |
259 ///Returns \c true if \c a is \e surely strictly less than \c b |
260 static bool less(Value a,Value b) { return a<b;} |
260 static bool less(Value a,Value b) { return a<b;} |
273 static Value zero() {return 0;} |
273 static Value zero() {return 0;} |
274 }; |
274 }; |
275 |
275 |
276 ///Unsigned integer specialization of Tolerance. |
276 ///Unsigned integer specialization of Tolerance. |
277 |
277 |
278 ///Unsigned integer specialization of \ref Tolerance. |
278 ///Unsigned integer specialization of Tolerance. |
279 ///\sa Tolerance |
279 ///\sa Tolerance |
280 template<> |
280 template<> |
281 class Tolerance<unsigned int> |
281 class Tolerance<unsigned int> |
282 { |
282 { |
283 public: |
283 public: |
284 ///\e |
284 ///\e |
285 typedef unsigned int Value; |
285 typedef unsigned int Value; |
286 |
286 |
287 ///\name Comparisons |
287 ///\name Comparisons |
288 ///See \ref Tolerance for more details. |
288 ///See \ref lemon::Tolerance "Tolerance" for more details. |
289 |
289 |
290 ///@{ |
290 ///@{ |
291 |
291 |
292 ///Returns \c true if \c a is \e surely strictly less than \c b |
292 ///Returns \c true if \c a is \e surely strictly less than \c b |
293 static bool less(Value a,Value b) { return a<b;} |
293 static bool less(Value a,Value b) { return a<b;} |
317 public: |
317 public: |
318 ///\e |
318 ///\e |
319 typedef long int Value; |
319 typedef long int Value; |
320 |
320 |
321 ///\name Comparisons |
321 ///\name Comparisons |
322 ///See \ref Tolerance for more details. |
322 ///See \ref lemon::Tolerance "Tolerance" for more details. |
323 |
323 |
324 ///@{ |
324 ///@{ |
325 |
325 |
326 ///Returns \c true if \c a is \e surely strictly less than \c b |
326 ///Returns \c true if \c a is \e surely strictly less than \c b |
327 static bool less(Value a,Value b) { return a<b;} |
327 static bool less(Value a,Value b) { return a<b;} |
340 static Value zero() {return 0;} |
340 static Value zero() {return 0;} |
341 }; |
341 }; |
342 |
342 |
343 ///Unsigned long integer specialization of Tolerance. |
343 ///Unsigned long integer specialization of Tolerance. |
344 |
344 |
345 ///Unsigned long integer specialization of \ref Tolerance. |
345 ///Unsigned long integer specialization of Tolerance. |
346 ///\sa Tolerance |
346 ///\sa Tolerance |
347 template<> |
347 template<> |
348 class Tolerance<unsigned long int> |
348 class Tolerance<unsigned long int> |
349 { |
349 { |
350 public: |
350 public: |
351 ///\e |
351 ///\e |
352 typedef unsigned long int Value; |
352 typedef unsigned long int Value; |
353 |
353 |
354 ///\name Comparisons |
354 ///\name Comparisons |
355 ///See \ref Tolerance for more details. |
355 ///See \ref lemon::Tolerance "Tolerance" for more details. |
356 |
356 |
357 ///@{ |
357 ///@{ |
358 |
358 |
359 ///Returns \c true if \c a is \e surely strictly less than \c b |
359 ///Returns \c true if \c a is \e surely strictly less than \c b |
360 static bool less(Value a,Value b) { return a<b;} |
360 static bool less(Value a,Value b) { return a<b;} |
375 |
375 |
376 #if defined __GNUC__ && !defined __STRICT_ANSI__ |
376 #if defined __GNUC__ && !defined __STRICT_ANSI__ |
377 |
377 |
378 ///Long long integer specialization of Tolerance. |
378 ///Long long integer specialization of Tolerance. |
379 |
379 |
380 ///Long long integer specialization of \ref Tolerance. |
380 ///Long long integer specialization of Tolerance. |
381 ///\warning This class (more exactly, type <tt>long long</tt>) |
381 ///\warning This class (more exactly, type <tt>long long</tt>) |
382 ///is not ansi compatible. |
382 ///is not ansi compatible. |
383 ///\sa Tolerance |
383 ///\sa Tolerance |
384 template<> |
384 template<> |
385 class Tolerance<long long int> |
385 class Tolerance<long long int> |
387 public: |
387 public: |
388 ///\e |
388 ///\e |
389 typedef long long int Value; |
389 typedef long long int Value; |
390 |
390 |
391 ///\name Comparisons |
391 ///\name Comparisons |
392 ///See \ref Tolerance for more details. |
392 ///See \ref lemon::Tolerance "Tolerance" for more details. |
393 |
393 |
394 ///@{ |
394 ///@{ |
395 |
395 |
396 ///Returns \c true if \c a is \e surely strictly less than \c b |
396 ///Returns \c true if \c a is \e surely strictly less than \c b |
397 static bool less(Value a,Value b) { return a<b;} |
397 static bool less(Value a,Value b) { return a<b;} |
410 static Value zero() {return 0;} |
410 static Value zero() {return 0;} |
411 }; |
411 }; |
412 |
412 |
413 ///Unsigned long long integer specialization of Tolerance. |
413 ///Unsigned long long integer specialization of Tolerance. |
414 |
414 |
415 ///Unsigned long long integer specialization of \ref Tolerance. |
415 ///Unsigned long long integer specialization of Tolerance. |
416 ///\warning This class (more exactly, type <tt>unsigned long long</tt>) |
416 ///\warning This class (more exactly, type <tt>unsigned long long</tt>) |
417 ///is not ansi compatible. |
417 ///is not ansi compatible. |
418 ///\sa Tolerance |
418 ///\sa Tolerance |
419 template<> |
419 template<> |
420 class Tolerance<unsigned long long int> |
420 class Tolerance<unsigned long long int> |
422 public: |
422 public: |
423 ///\e |
423 ///\e |
424 typedef unsigned long long int Value; |
424 typedef unsigned long long int Value; |
425 |
425 |
426 ///\name Comparisons |
426 ///\name Comparisons |
427 ///See \ref Tolerance for more details. |
427 ///See \ref lemon::Tolerance "Tolerance" for more details. |
428 |
428 |
429 ///@{ |
429 ///@{ |
430 |
430 |
431 ///Returns \c true if \c a is \e surely strictly less than \c b |
431 ///Returns \c true if \c a is \e surely strictly less than \c b |
432 static bool less(Value a,Value b) { return a<b;} |
432 static bool less(Value a,Value b) { return a<b;} |