Re: [eigen] Bug in traspose

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi Beniot,

> - add a comma-initializer (class with overloaded operator,) allowing to do 
> things like
> Matrix3d m;
> m.list(), 1, 2, 3 .newline(),
>           4, 5, 6 .newline(),
>           7, 8, 9 .end();
> In this design, m.list() returns an object of 
> type "CommaInitializer<MatrixType>" which stores a reference to m, and 
> subsequently one calls CommaInitializer::operator, , 
> CommaInitializer::newline(), CommaInitializer::end;
> The matrix m may be of dynamic size but it must have its correct size before 
> calling m.list().

I like this idea alot but I have one small suggestion.
Replase Matrix<T,S>::list() with operator<<= and
CommaInitializer<MatrixType>::operator, with CommaInitializer<MatrixType>::operator()
and use operator,() instead of newline and maybe ! instead of end() or maybe we don't need end()
at all...
Then we should be able to write initializers like
Matrix2d m;
m <<= (1, 2),
      (3, 4);

Is there a problem with this?

It would be nicer to get a form like this:
m = ((1, 2),
     (3, 4));

but this would require overloading the return of the operator= which is impossible.
Maybe this would be ok?
m <<= ((1, 2),
       (3, 4));

Cheers
Ben





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/