Re: [eigen] Matrix - Scalar CwiseUnaryOps |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Matrix - Scalar CwiseUnaryOps*From*: Eamon Nerbonne <eamon@xxxxxxxxxxxx>*Date*: Wed, 4 May 2011 15:20:53 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=o9SRHYeiwRY84PfVwcnbXow5AhMt+Oqkjrq2n9dRPQM=; b=xgOfKbwi8JtgIyRATo07Q08Khrw5GAvCv7y+wF9DKcB4uFrDAEMH6x47KkT4PCxwFA ibZ38rw6zXNOoSs5vg8qV1C19EAe+gqH8HMSrMxAJxDDbuxjiJHrg6JCV+lwWWl3QtQf dwgTCKLcm9df2FNtTHqd1l9dJOVR/+a4eQ1JE=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=TuBvn+kUXxZ+DwET8OhJbK20LRl7LuEZRa9rAD+dryUyv4DHgJBQLxNRIdhI8/TUub F5S1ruliTgw0rqMaKEL3gp8Cqck4K+Rd1SYs8SKMSfFQ95etAmGGgS0/NaflDYE1kkSw kOE9p0+QuokUrzB9FYDg1nqxCuPaBzA2QehTU=

Isn't that just (matrix.array()+scalar).matrix()? To me such a method would not be worth the confusion of the API clutter.

On Wed, May 4, 2011 at 15:08, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:

What we could have is a method for doing that.

Like, matrix.cwiseSum(scalar)

if we don't have such a thing already.

Benoit

2011/5/4 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:

> Ok. fine enough. I just thought we could be a bit less strict here but

> I understand your reasoning.

>

> On Wed, May 4, 2011 at 2:55 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:

>> Yes, the ambiguity is between interpreting a+M as

>> 1) aE+M where E is the matrix all of whose coefficients are 1; this

>> is what we do for arrays; or

>> 2) aI + M where I is the identity matrix; this is definitely what

>> mathematicians mean by a+M whenever they use that notation. This is

>> required if you want basic matrix arithmetic rules to be self

>> consistent, e.g. distributivity: (a+M)*N = aN + M*N

>>

>> This ambiguity is the primary reason why we leave this undefined in Eigen.

>>

>> Benoit

>>

>> 2011/5/4 Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>:

>>>

>>> Hi,

>>>

>>> From a mathematical point of view a.M is defined but a+M is not...

>>> (a=scalar, M=Matrix).

>>>

>>> my 2 cents..

>>>

>>> Thomas

>>>

>>> --

>>>

>>> Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>

>>>

>>> http://www.freehackers.org/thomas

>>>

>>> On Wednesday 04 May 2011 11:39:13 Hauke Heibel wrote:

>>>

>>>> Hi,

>>>

>>>>

>>>

>>>> I know that we have the array functionality for those operations but I

>>>

>>>> wonder whether we should enable +/- operations between matrices and

>>>

>>>> scalars.

>>>

>>>>

>>>

>>>> We already have * and / and thus I think it might make sense. It's

>>>

>>>> just for convenience and I have met quite a few occasions where this

>>>

>>>> feature would lead to shorter code. What do you think?

>>>

>>>>

>>>

>>>> - Hauke

>>>

>>>>

>>>

>>>>

>>>

>>>>

>>>

>>

>>

>>

>

>

>

**References**:**[eigen] Matrix - Scalar CwiseUnaryOps***From:*Hauke Heibel

**Re: [eigen] Matrix - Scalar CwiseUnaryOps***From:*Thomas Capricelli

**Re: [eigen] Matrix - Scalar CwiseUnaryOps***From:*Benoit Jacob

**Re: [eigen] Matrix - Scalar CwiseUnaryOps***From:*Hauke Heibel

**Re: [eigen] Matrix - Scalar CwiseUnaryOps***From:*Benoit Jacob

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Matrix - Scalar CwiseUnaryOps** - Next by Date:
**[eigen] GCC-4.6 compilation problem + patch** - Previous by thread:
**Re: [eigen] Matrix - Scalar CwiseUnaryOps** - Next by thread:
**[eigen] GCC-4.6 compilation problem + patch**

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