Boost logo

Boost :

From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-09-07 13:39:58


Hi Herve,

you wrote:

> First thanks for taking the time to compile ublas test and benchmark
> with interval and checking that indeed the interval type behaved just as
> expected in your setting.

No need to thank. I was curious, if the matrix library would accept other
scalar types besides the usual floating point types, too ;-)

> It's exactly the kind of things we'd like to
> know for a formal review.
>
> On Sat, Sep 07, 2002 at 03:15:48PM +0200, Guillaume Melquiond wrote:
> > You are not mistaken, the library is not designed to support mixed
> > operations and it's a limitation (I'm not sure about "severe").
> > ...
> > This problem isn't really new. A lot of libraries suffer from the same
> > limitation, beginning with the standard library (just try to do
> > 'complex<double> = complex<double> + complex<float>').
>
> Note that for intervals, it was a question at some point whether we
> should provide specializations for T==float, double and long double,
> with additional implicit conversions for float->double->long double.
> For those ones, we can guarantee at least that there is no loss of
> precision.

Implicit conversion may be one way to go. Another way could be to use type
promotion traits as described by Todd Veldhuizen for example here:

http://osl.iu.edu/~tveldhui/papers/techniques/techniques01.html#l30

> We didn't provide it in the end because the problem remains for
> converting the policies. You may have interval<float> with your own
> rounding policy and it's not clear at all we can convert this rounding
> policy to operate on double, unless we know which policy you are using.
> We could offer the functionality for just the default policies, but that
> wouldn't be a generic solution.

I believe, I see the problem.

> If you feel that conversion should be offered between selected types,
> perhaps we can start a thread to investigate how that should be done.

I believe, mixed operations should be better supported.

> > You are right, it's not a problem of the interval library. The C++
> > Standard says that "the effect of instantiating the template complex for
> > any type other than float, double or long double is unspecified"
(26.2.2).
> > Not being able to instantiate complex<interval> because the Standard
> > decided the only interesting types are float, double and long double is
> > really a pity.
>
> And I may add we wanted to offer a type interval<T> that is not
> restricted to float, double, and long double, partly not to follow the
> example of std::complex.

As we tried with vector and matrices ;-)

Best regards

Joerg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk