Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2006-11-30 06:25:41

On Sunday, 19. November 2006 00:54, Manoj Rajagopalan wrote:
> hi,
> why does it not inherit matrix_expression<matrix_container<M> > like
> all other classes that inherit matrix_expression.
> I have been trying write functions that work with matrix<> and
> matrix_range<> objects and other matrix-pattern adaptors (like
> triangular_adaptors<>) and this asymmetry in inheritance is getting in
> the way of my type computations.
> Any hints?

Good question. The matrix_expression and matrix_container base classes are
simply tags that mark types that model the 'Matrix Expression' and 'Matrix'
concept. They simply allow you to provide type specific formal parameters.

void matrix_function (const matrix_container<C> &e);
  Will only match any models of MatrixIn this case C is the actual type of the
Matrix. For example 'matrix'.
void expression_function (const matrix_expression<E> &e);
  Will match models of 'Matrix Expression' and 'Matrix'. In this case E is the
actual type. For example 'matrix' or 'matrix_matrix_binary'.

If we inherited from matrix_container<M> from
matrix_expression<matrix_container<M> >
then the above would not be true. Then the E of expression_function(matrix)
would be matrix_container<M> which is not what we want.

Do you have a concete example the problem as you see it.


Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering