Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2005-06-30 07:33:25

On Thursday 30 June 2005 11:49, Gunter Winkler wrote:
> On Wednesday 29 June 2005 23:58, Michael Stevens wrote:
> > Dear All,
> >
> > Does anyone know why the vector/matrix_expression class requires Default
> > Constructable?
> Because the derived types vector and matrix use it? Having a
> container_expression type as base type would avoid this. BTW there is no
> constructor in matrix_expression and only protected constructors in
> ublas_expression.

Was very late when I wrote this. I was actually thinking of the classes which
model a Vector/Matrix Expression (which vector/matrix_expression don't to
everyones confusion).

They all have the following pattern
        vector_binary ():
            e1_ (), e2_ () {}
        vector_binary (const expression1_type &e1, const expression2_type
            e1_ (e1), e2_ (e2) {}

With the default constructed e1_ and e2_ being rather useless.
It also forces vector/matrix_reference and all the proxies to have a
'nil_' static member which is wasteful an ugly.

> Another remark:
> What do you think about moving ublas_expression and scalar_expression out
> off vector_expression.hpp into a new header (detail/ublas_expression.hpp or
> scalar_expression.hpp).

I think this is a good idea. I would move everything that does not model a
Vector/Matrix Expression it such a header. That is the types:
ublas_expression, scalar_expression, vector_expression, matrix_expression.