|Re: [eigen] inconsistent cwise() support|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] inconsistent cwise() support
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 18 Nov 2009 15:14:56 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=KzN3jLqKG98LF4Gbfup67Frf7i0Ioz6cSoWe4Oeusd8=; b=ljw+oAuDn6AQn6On2itcp6uMwt3Szk6lqDyz2J7lh1lcOt4rmjD3W0JdjtqpWy2Ed8 V0NuOdVU6fpQE0EsFwJcJQy0aQZHOk+q9k6mt+D82t9qAApZ849aEiD+zDOLCwcxO9az 5+yzoUvc7JS9BNHEPVe6zOIpujLlXUXh02hc8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=VAq2sMFhNeiooiq7nrVxStcOa4zDQTZfpTe7UpZmcrYB783SK17k6xEff75hyhG6bd O4YO9NjQMta7WE5T1yx1kbznsa/nwstHeF0eZgwNitNz8WTmHCsDU0sCC4TetyCpUK/U HI6ZdESbtoNv78zLio5v6rcR+aNNrGo9hqTs0=
2009/11/18 Schleimer, Ben <bensch128@xxxxxxxxx>:
> I wanted to stop lurking and jump in with my two cents.
it's been a long time!
> I think from a user's perspective it would be clearest if operations that
> are component wise are always marked with cwise() or array(). Example:
> MatrixdX matProd = A * B; // legal, indicates the matrix product of A and B
> MatrixdX compProd = A.cwise() * B.cwise(); // legal, indicates the
> component product of A and B
> MatrixdX invalidProd = A.cwise() * B; // illegal, this isn't a matrix
> product or pre-component product
> MatrixdX invalidProd = A * B.cwise(); // illegal, same as above
Yes, that's exactly where we are going, but with array() instead of cwise()..
> likewise, exp() would be the same:
> A.exp() -> matrix exponential
> A.cwise().exp() -> per-component exponential
> I'd advocate for the sake of consistency that:
> MatrixdX sum = A.cwise() + B.cwise(); // legal
> MatrixdX sum = A + B; // illegal
For addition there is no ambiguity at all, since matrix addition is
coefficient-wise addition. Also, for matrix addition, this matches the
natural mathematical notation. Thus, i don't see a reason to make that
> Adding .cwise() (or .array()) to the end of the matrix name is not a huge
> burden and makes the subjects of the operation explicit.
Well, I think it's a big burden for such a common operation (the point
of tolerating such a .array() syntax elsewhere is that these are less
common operations on matrices), and I don't see how it is more
explicit since there was no ambiguity.