|Re: [eigen] new tutorial on writing functions taking Eigen types as paramters|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] new tutorial on writing functions taking Eigen types as paramters
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 5 Aug 2010 08:16:46 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=OfsZMcN4XKWfkZy9XqHyodfL7SXYN6RgKkD/itmaxQk=; b=nRzMGCDyx1iIFqws9GJel8Zt+b8m6x2SXiByh1sxLcTx5XnFEdR/YZKgdYVJTLtXOt DM6cFZbajhwpQUvIVAERgFdZk4qt1NSPl+/UcNgVAzROnEKEWjTCWOZu8uCPWEpweUgz Y1f9qoKujL4rNzKhEYU4y8Fd8dGShChUVhsH8=
- 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:content-transfer-encoding; b=GKePAEQF+OXCty/NqbduOlD14mv3Oqqxdz2QsQUSD2j6/er8BjZsnhul3pzUXtfINE LLM3g/8XM7SGiqZ7tgBPhxcQLXKfnyQB2YlahYdC4xcT1BBprHyr0AfKvq+TBRHVca0H JBGB3+wT3ygREGd6pVnNMoPzlxQWVe+O0MBo4=
2010/8/5 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> On Thu, Aug 5, 2010 at 3:57 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>>> I have allowed myself to make directly some changes into your page,
>>> tell me if you'd have preferred discussing a patch first.
>>> - i have rephased the beginning to be more precise.
> I like your changes - now the page looks really nice.
> One question, maybe that goes to Gael as well. I am stating at some
> point that the examples at the bottom (the cov function) can be used
> on Arrays too. This is not completely correct, because the matrix
> product has a different meaning (I could use .matrix()) but it does
> not even compile. Is this expected. I was thinking that for all those
> methods (operator*, rowwise().sum(), etc.) it should definitely be
> possible to use them on Matrix and Array.
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.
Looking back at this page I see a few more places that have room for
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
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" ?