Boost logo

Glas :

Re: [glas] Re: GLAS requirements

From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2005-01-07 06:14:42


Hello GLAS-iers,

First I would like to wish you all a fruitful year. Therefore I would like to
plant the first seeds for our project.

I think the first question we have to pose, is to which value types we want to
apply vectors and matrices. Do we restrict ourselves to integer types, real
and complex floating point types or do we allow more?

Some users might want to work with rational types, polynomials, etc.

In the latter case, there is no problem for vector and matrix containers,
proxies (rows, columns, submatrix, subvector, slices, elements, etc.).

The problems arise when we want to evaluate expressions, e.g.
x = a* b + c* d

I believe we have to allow any value_type, but then these value types should
have to satisfy some conditions:

I think the values should be in a ring. In brief, this implies there are
* operator+() (and operator-() )
* operator*() ( and operator/() )
* a zero element
* a one element

In order to organize this properly, I suggest we define a value_traits class
that contains the following for each value_type.

template <class T>
struct value_traits {
   typedef T value_type ;
   typedef T& reference ;

   /// Set t to one.
   void one( reference t ) ;

   /// Set t to zero.
   void zero( reference t ) ;
};

Have a nice day,

Karl