Re: [eigen] new tutorial on writing functions taking Eigen types as paramters

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


On Thu, Aug 5, 2010 at 2:16 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> There are 2 different things here:
>  - the fact that operator* has a really different meaning on matrices
> and on arrays, is of course wanted.
>  - but the fact that .matrix() fails on a matrix is not wanted, IMO.
> It's just that we forgot to add a trivial .matrix() there (of course
> just returning reference to *this) and likewise, add trivial .array()
> on array expressions.

AFAIK, I introduced Matrix::matrix() already quite some time ago for
other expressions I don't know.

Regarding my first post I was once again too hasty. I did not properly
replace everything by Array but left the RowVecotrXf declaration as
RowVectorXf which does not play nicely with array unless you call
..array() or use an array.

> Looking back at this page I see a few more places that have room for
> improvement:
> 1) the first Array example,
>    std::cout << "max: " << (a.max(b)).maxCoeff() << std::endl;
> is a bit not-real-world. How about just taking 1 parameter 'a' and
> doing a.abs().maxCoeff() ? This is definitely array-specific.
>
> 2) the phrase "simple functions" (used to mean "function taking a
> plain Matrix argument") is not precise/explicit enough, and gives the
> impression that Eigen is something complicated in which simple things
> don't work! Why not e.g. "When does passing plain Matrix arguments
> fail?"
>
> 3) the section "How to resize matrices in generic implementations?": two things:
>  - since you want to write about this, why not just introduce the
> base class DenseStorageBase? It is the base class for Matrix and Array
> i.e. anything that is a plain object as opposed to an abstract
> expression, hence can be resized. DenseStorageBase inherits either
> MatrixBase or ArrayBase, depending on the XprKind of the Derived type.
>  - The title itself,  "How to resize matrices in generic
> implementations?" is not precise enough, why not e.g. "How to write
> functions resizing generic arguments" ?

I will make those changes when I find more time.

- Hauke



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