Re: [eigen] Proposal: add M.fill(y) as a synonym for M.setConstant(y)

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


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
>



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