Re: [eigen] inconsistent cwise() support |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] inconsistent cwise() support
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 16 Nov 2009 13:22:01 -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; bh=y66OI0ECA8yTl0QkyOgGxLfy477Aj/4jZdLodDrIIQU=; b=t/ZS8fyyErXVJXtjnMrgHB0T6oBkMkHsGQs17YtSgvBkI0BefhbaEnhBB34gSfi4JY GVPnC2SLXJNvnjgalCZfJm1KJ9dQodh403l7CqsjoG/o9ji7IpI7Omqi57DHH1lHee+8 3D/fi9WLPfO0bQcvrg+UqqoUGCM+poaTIjVgw=
- 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; b=glEPWAYo1mx+mG/0O2LWQFG5PE0RBSxynOqcygB2n0EMbTJs0K794sGdrSuGa4uK8C ymXNlDL3Zg81Aw2QCkbY4WhgCXHp/WfqfItbNiEH3RckLlUBGl/qTPrgC3UhH5X8JSCH /agY+UhSKp8Aoe9n7HnzRHjcQft1HyKmoI2h8=
2009/11/16 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Hi,
>
> I've just stumbled over a strange issue. I tried to normalize a matrix such
> that all its entries are between 0 and 1 and tried this.
>
> a -= a.minCoeff();
> a /= a.maxCoeff();
>
> It did not compile.... then, I tried this
>
> a.cwise() -= a.minCoeff();
> a.cwise() /= a.maxCoeff();
>
> again, it did not work. :)
>
> What did work and this is rather confusing is the following:
>
> a.cwise() -= a.minCoeff();
> a /= a.maxCoeff();
>
> I think this is a bit unintuitive. Do you think we can change this in the
> future?
It seems like what you want is Gael's proposal for "true array support".
The Matrix class is meant to be that: a matrix, not a generic array.
As such, we support natively, without cwise, only the operations that
are defined in linear algebra. These are typically the operations that
are equivariant wrt base change
vector / scalar is a standard operation in matrix theory. It has a
geometric meaning independent of base change.
vector - scalar is not a standard operation; it doesn't have a
geometric meaning. Actually matrix - scalar is sometimes used as
matrix - scalar*Identity, so that's another reason not to let it mean
coeff-wise substraction.
So all you're hitting here is that you're using Eigen::Matrix when
what you really want is a generic array where all operations are meant
coeff-wise and no geometric interpretation is sought.
Benoit
>
> Regards,
> Hauke
>