|
Ublas : |
From: Sourabh (sourabh_at_[hidden])
Date: 2007-02-28 06:16:02
On Wed, 28 Feb 2007, Gunter Winkler wrote:
> On Wednesday 28 February 2007 11:19, Sourabh wrote:
> > #include <boost/numeric/ublas/matrix_sparse.hpp>
> > #include <boost/numeric/ublas/io.hpp>
> >
> > using namespace boost::numeric::ublas;
> >
> > int main () {
> > typedef mapped_matrix<double> Matrix;
> > typedef mapped_matrix<Matrix> MyMatrix;
> > MyMatrix m;
> > MyMatrix n;
> > MyMatrix l;
> >
> > MyMatrix k = m + n;
> > }
> >
> > This program, on compilation gives the following error:
>
> The error is thrown, because there is no comparison operator for matrices.
> However, the sparse assignement must be able to decide whether an element of
> MyMatrix is "zero" or not.
>
> The construction of nested matrices is not supported by ublas. In order to
> work, you Matrix-class has to behave like a scalar:
>
> * comparison: operators ==, != (for sparse types)
> * useful default constructor (which has to construct the zero element)
>
> mfg
> Gunter
>
>
>
>
Hi Gunter,
Thanks for replying.
I did not understand your statement (MyMatrix has to behave like a
scalar). Can't ublas infer the type (vector) and drive the corresponding
operator on the elements ?
Please explain.
--
-- Sourabh