Re: [eigen] inconsistent cwise() support

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


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
>



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