Re: [eigen] Proposal: add M.fill(y) as a synonym for M.setConstant(y) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Proposal: add M.fill(y) as a synonym for M.setConstant(y)
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Sat, 24 Jan 2009 12:06:13 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=pBwfD/dqGUyDkspPPCB4fTEqqa+UIvboMqE11ibtgbk=; b=PyWGrW0XhJB9p9bDh4j+yVtShSfTQhAbOxHRnY03M+vHjEq/wL5/cmn8x64D7W/vN3 UJETdcK3T6RUjetB5EvJfsuFK7fOyL0wJ9vSN8HxlrZKGr8pzqFQSUC+5fkgkko8z1FU /AzfW/Wp/2V7LeutkqisG74xBoIbKbvhwojPQ=
- 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=eAtkOqa66IVJSGZ8a2vwkctrWvdGFg+Rs+DaBDb90hifb1bB5HpsLn+IdL5YKJMAJ8 6m4o/+faUP7ycJyHXYjuZnGMZZy+wgnKUFCd4HAM4QwXuPWnjvBWbvspcz3XsKArE9T1 5Lb6ncOlNmOWjAiQosGEXs5le/NGmvPzXZO1I=
internally setZero() is the same than m = Constant(0), and the
compiler optimizes it very well.
On Sat, Jan 24, 2009 at 11:54 AM, Ricard Marxer Piñón
<email@xxxxxxxxxxxxxxxx> wrote:
> Ok, I thought .setZero may have been optimized and therefore it would not be
> the same as fill(0). But I don't know enough of the internals yet.
>
> On Sat, Jan 24, 2009 at 9:26 AM, Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
> wrote:
>>
>> just let me recall for everybody that actually m.setConstant(y) is an
>> alias for: m = MatrixType::Constant(y); whence the name setConstant
>> which is also consistent with all other set*() functions.
>>
>> Said that I'm ok to add .fill(y) as an alias, it is indeed probably
>> easier to find. But no fillZero() or whatever else, having fill(y) is
>> enough since this already makes fill(0) a "fill" based alias for
>> setZero()...
>>
>>
>>
>>
>> On Sat, Jan 24, 2009 at 8:12 AM, Ricard Marxer Piñón
>> <email@xxxxxxxxxxxxxxxx> wrote:
>> > And looking a bit more, there is also setOnes and setRandom which should
>> > be
>> > consistent as well. I don't know about setIdentity though, fillIdentity
>> > seems weird to me. Just some thoughts.
>> >
>> > On Sat, Jan 24, 2009 at 8:05 AM, Ricard Marxer Piñón
>> > <email@xxxxxxxxxxxxxxxx> wrote:
>> >>
>> >> Oh, sorry I didn't see that you were proposing it as a synonym. My new
>> >> question is should there also be then the synonym fillZero() or
>> >> fillZeros()?
>> >>
>> >> On Sat, Jan 24, 2009 at 8:03 AM, Ricard Marxer Piñón
>> >> <email@xxxxxxxxxxxxxxxx> wrote:
>> >>>
>> >>> Would then .setZero() change to fillZero() (of filZeros()) or stay the
>> >>> same ?
>> >>>
>> >>> I just think these two methods do the same and should be called
>> >>> similary.
>> >>>
>> >>> ricard
>> >>>
>> >>> On Fri, Jan 23, 2009 at 11:44 PM, Benoit Jacob
>> >>> <jacob.benoit.1@xxxxxxxxx>
>> >>> wrote:
>> >>>>
>> >>>> +1 from me, waiting for Gael approval...
>> >>>>
>> >>>> Btw Gael if you're ever looking for a job in Toronto, since today you
>> >>>> gave good chances. I made you sound like some sort of guru of cache
>> >>>> friendliness...
>> >>>>
>> >>>> Benoit
>> >>>>
>> >>>> 2009/1/23 Keir Mierle <mierle@xxxxxxxxx>:
>> >>>> > I find the notation M.setConstant() odd, because in for example
>> >>>> > double y = ... something not constant.
>> >>>> > MatrixXd M = ...
>> >>>> > M.setConstant(y) // <--- y is not a constant!
>> >>>> > I propose adding an alternate method:
>> >>>> > M.fill(y)
>> >>>> > It doesn't overload the meaning of constant, is shorter, and has
>> >>>> > obvious
>> >>>> > intent.
>> >>>> > Thoughts?
>> >>>> > Keir
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> ricard
>> >>> http://www.ricardmarxer.com
>> >>> http://www.caligraft.com
>> >>
>> >>
>> >>
>> >> --
>> >> ricard
>> >> http://www.ricardmarxer.com
>> >> http://www.caligraft.com
>> >
>> >
>> >
>> > --
>> > ricard
>> > http://www.ricardmarxer.com
>> > http://www.caligraft.com
>> >
>>
>>
>
>
>
> --
> ricard
> http://www.ricardmarxer.com
> http://www.caligraft.com
>