Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2007-02-28 06:02:57


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