
Boost : 
From: Alberto Ganesh Barbati (abarbati_at_[hidden])
Date: 20060423 20:41:46
Bronek Kozicki ha scritto:
> Alberto Ganesh Barbati wrote:
>> template <typename T>
>> struct compare_absolute_error : std::binary_function<T, T, bool>
>
>> bool operator()(T x, T y) const { return abs(x  y) < eps; }
>> 1) Is there interest for this?
>
> I'm not math expert, but I certainly agree that such utility would be useful.
> However, as some standard algorithms need equality comparison, while
> containers need lessthan comparison, it would be nice to provide at least
> then both, and make names obvious enough.
I believe lessthan comparison are not very useful, in fact. That's
because whatever fuzzy algorithm you use, the induced relation won't be
transitive, so it won't induce a strictweak ordering. It's true that
also fuzzy equality does not induce an equivalence relation for the same
reason, yet the fuzzy equality is still useful even in absence of that
requirement.
>
>> 2) What are the comparison algorithms to include?
>
> good question. But if comparision algorithm is a template parameter (policy
> class), we do not have to define them all in advance.
>
Well... if you already had the comparison algorithm to put in a template
parameter, then you won't need a... comparison algorithm! The point here
is exactly to provide a library of readymade algorithms. Of course some
details might be finetunable via policy classes, as suggested by John
Maddock, but not the entire algorithm itself.
Ganesh
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk