Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-07-11 02:22:50


On Monday 11 July 2005 04:12, Andrew Rieck wrote:
> Dear Michael,
>
> > This is my suggested change to the default handling of traits. This
> > treats any
> > unknown type as a scalar and defines a default traits definition. This
>
> should
>
> > certainly be a lot easier for new users to use and simplify many cases.
>
> This work is already done in the following (excluding the redundant member
> functions):
>
> #include <limits>
> #include <boost/call_traits.hpp>

Your email got me thinking. I certainly dislike the ublas type_traits, and
using a boost/call_traits would be nice. Sadly the norms are always a
sticking point. We need some way to define these.

> Your model of scaler_traits is really a fat interface for a complex type,
> not for a generic scaler_trait.

> There is no need to include member functions like abs, etc, in a traits
> interface.

I think there is a logical reason to include abs etc, but not because they are
'needed'. I think the logic goes as follows:
  We need a definition of the norms. There is no generic solution to this, it
requires some type specific information. We therefore have a traits class.
Since we must have this class, we can provide and interface so the user can
specify specific implementations for all higher functions.

Interestingly for interval types there is the definition
        real_type abs (const_reference t) {
            return boost::numeric::abs (t);
        }

to make sure the abs of the interval is used.

All the best,
        Michael

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________