Re: [eigen] new tutorial on writing functions taking Eigen types as paramters |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] new tutorial on writing functions taking Eigen types as paramters
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Thu, 5 Aug 2010 14:33:29 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=EjerzZSh30nu9PTcLUEiFcW2e63x+ls4mVJ7yVSKPvE=; b=RWG42VOWceJbi3tfWTnZbRB/ErO0141x0F04giB4JAHjlO4eTmxb890G7/XbC+6Eqc 96fPRLTxKYKYyl1o5A/NTxCRycmxoPuqLMauRqJo0VLVSGFu+gqsN7gC2DHkdUG4hon7 SCOlxACqNIWAmMaN4XVVd9ryxeTFgNDZMtwaw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Gd0sgsJ1hO8YhxIX0Y/58zNqBZy6FRNaZpQCDkF/4oYUjJZxaJoR+OYz51d2Ocxi7R /qLH4M3HH0/IJNDcN8TeBrV8uplnsZ4SXmbEQI8yB7mZ+2Nygpzli5iuqydN662IgHw+ K5Qyi0Hp0w4eB6Ejeaa3vtL+YZN9s6Dnb9aA8=
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