Re: [eigen] Bug in traspose |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Bug in traspose
- From: "Schleimer, Ben" <bensch128@xxxxxxxxx>
- Date: Thu, 17 Jan 2008 11:26:56 -0800 (PST)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=msq7b1QzeFwCsSvyPh55UTbaDLh0YoGZXLdtylfoZHZAYY+HdKz47Xr5QYvKPjQ7OWdlFSPpR/wvKXQGKSNEYBUpy30rj2uWPXrL/HlOGf45XOgy1W3al+npPGKVq7sqOAj1nU8xInZY40OoQqsfVlDUWPIkRnwaY2r8Z0uYQX0=;
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