From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2002-07-02 09:44:03
----- Original Message -----
From: "Joerg Walter" <jhr.walter_at_[hidden]>
Sent: Tuesday, July 02, 2002 1:22 AM
Subject: Re: [boost] ublas type safety and bound check
> but are currently disabled due to the usual problems with floating point
> arithmetic when checking too strict. I'll discuss with Mathias, how to
> install a customizable comparator.
Customizable numeric comparators are at the heart of generic numerical code.
It would be great if this is used in uBLAS.
If you do develop such a comparator, make sure to do it such that it can be
gradually turned into a first-class boost citizen. Chances are that
subsequent numeric libraries would use it.
BTW, I was thinking how could you introduce such thing in the current design
with not too many changes.
An strategy that may prove very useful for all sorts of customability is the
one used by the CGAL library (for Computational Geometry).
The idea is that the single-template-parameter taken by the classes is not
simply a numeric type but a whole class called a 'Kernel'.
A Kernel exposes the 'value_type', but also any other types that might be
required, such as a comparator. It also exposes specific low-level
algorithms via function objects.
These kernels can designed in a way that a user can extend a given default
kernel to suit her/his needs and just plug it into a class (ublas::vector,
for instance) to automatically achieve the desired behavior (a Kernel is a
Policy class with a specific protocol).
Using a kernel-traits class, it is possible to retain full backward
compatibility: plain numeric types, such as 'double', can be viewed as a
If you are interested in adopting this approach just contact me privately.
I can also give you privately the code of my own generic comparator that you
could use as a starting point, if you like.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk