|
Boost : |
From: Brook Milligan (brook_at_[hidden])
Date: 2007-09-19 09:37:53
Andrew Sutton writes:
> I mostly agree, but I think we can do better too. One of the reasons
> that it probably took the name distance_zero() is that there haven't
> been many motivating examples of non-additive combinations of
> distance (and hence identities).
I suspect that you are right in that regard as most mathematical
algorithms are specified in terms of summations. However, I ran into
the more general case when I tried to develop generic graph-based
algorithms for probability models, which require products. There is
one example included in the probability library I have developed,
which is described at:
http://biology.nmsu.edu/software/probability/
> I'm wondering if it might not be worthwhile to build simple
> structures that provide the function types and constants for these
> algorithms rather than specifying them as distinct parameters. For
> the common case, these would simply default to the basic additive
> operations and identities but could be easily overridden.
By this I take it that you mean something along the lines of
std:limits<> that defines various properties of the type? That would
certainly better integrate the concepts and simplify the graph
algorithm interfaces.
Cheers,
Brook
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk