Boost logo

Boost :

From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-04-05 15:33:40


Hi Peter,

you wrote:

> currently I'm fighting with the followinf ublas problem:
>
> typedef numerics::matrix<double, numerics::row_major,
> numerics::unbounded_array<double> > TpMatrix;
> typedef numerics::matrix_range< TpMatrix > TpMatrixRange;
>
> TpMatrix U( 1, 2 );
> TpMatrixRange r1 = TpMatrixRange( U, numerics::range( 0,1),
> numerics::range( 0,1) ); // o.k.
>
> TpMatrixRange r2 ;
> r2 = TpMatrixRange( U, numerics::range( 0,1), numerics::range( 0,1) ); //
???
>
> Works for r1, but not for r2 on my Debian/Linux g++2.95.4:
>
> t: /home/peter/DMRG/boost/numeric/ublas/storage.h:41: const size_t &
> numerics::common_impl_ex<size_t>(const size_t &, const size_t &, const
char
> *, int): Assertion `size1 == size2' failed.
>
> Is this intended ?

Yes ;-) I think, the corresponding documentation doesn't state clearly
enough, that the assignment of proxies like matrix_range has the same
semantics as the assignment of containers, i.e. the referenced elements are
copied but not the references itself.

This means for your example, that the copy of elements from the sub matrix
of U to the empty sub matrix r2 must fail.

BTW, the default constructor of matrix_range is currently useless for an
application and is therefore not documented.

Best regards

Joerg


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk