Re: [eigen] refactoring fork: some news

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


2009/12/20 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> On Fri, Dec 18, 2009 at 10:53 AM, Gael Guennebaud
> <gael.guennebaud@xxxxxxxxx> wrote:
>>
>> Still about Array, let me recall that we agreed upon removing .cwise() in
>> favor of a few cwiseXXX function for Matrix objects (e.g.,
>> mat.cwiseProduct(mat), mat.abs()), plus a MatrixBase::array() function
>> allowing to see a matrix as an Array, e.g.:
>>
>> (mat.array().abs()>10).select(A,B);
>
> The array() notation is beautiful - I am just wondering whether we really
> need cwiseProduct(...) & co. If I am reading Benoit's e-mail correctly, he
> is also assuming that the majority will go for array().

There are cases where .cwiseProduct returning a matrix xpr is still
quite more concise, e.g.

  (m1.array() * m2.array()).matrix().someMatrixSpecificMethod();
or, if you prefer,
  m1.array().operator*(m2.array()).matrix().someMatrixSpecificMethod();

versus

  m1.cwiseProduct(m2).someMatrixSpecificMethod();

..array() / .matrix() convert permanently between the two worlds, so if
you only wanted one array operation in the middle of a chained matrix
computation, it's a bit cumbersome, so we thought we could add a few
methods like cwiseProduct for some common use cases.

Though it must be said that in many cases you wouldn't have to convert
back to matrix(), because many methods like the above example,
select(), also work on arrays.

Benoit



>
> - Hauke
>



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