Re: [eigen] API addition: resizeLike(const Mat & other); |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] API addition: resizeLike(const Mat & other);
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Mon, 2 Feb 2009 10:47:19 +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=qSl2t2DIvFFkqoch8/TlPGo/Ccuv8a8cNDxIB/HceWM=; b=nz7Z8AzD5yuzltODFTqk0N0wvBr3I0ymr2ZX/4/AJMgjMIueNPp35J2F+GC80Xp70L SNA+UWPrxOLMO7I4zQ7VrDwGVJuNY4FQ1R0KeZCVp8rxWDL2sydTVQpPtUvGo7Zj8IKA 8mSxUBYuvxLxpSQlHUFgP6JdhuKa3q/a2t2FE=
- 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=kpgTWQfUgLkWkFxEj11c6p9/JvX25Lr4Z+r2dmE/8S+KJAriOYmkzyb/1JhRlCAe/i Wce07wvcGbrMDLmn0JJ7F0Y+WSkRzDPEYJmSJ6+EADCTo/aKjqBNeDIVChxBZFIrTbqd D9Vq6a2ALfptjJ0AhzoZB4kDA2QaI55B6YVV4=
I vote for resizeLike()
gael
On Mon, Feb 2, 2009 at 1:43 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> 2009/2/2 Keir Mierle <mierle@xxxxxxxxx>:
>> I propose adding .resizeLike(const mat &other) which resizes *this to
>> be the same size as other. I find this is something I do fairly often,
>> and there is precedent in numpy (empty_like(), zeros_like,
>> ones_like()).
>>
>> Any objections? If not, I'll send a patch.
>>
>> Alternately: we could overload .resize() to take a matrix argument.
>> That may be misleading; I could be convinced either way.
>
> +1 to the idea, and I also don't know what I prefer.
>
> In either case, please take care of the vector case as we already do
> in resize(int).
>
> Actually you could leverage what we already do in resize(int):
> resizeLike(other)
> {
> if(IsVectorAtCompileTime)
> resize(other.size());
> else
> resize(other.rows(), other.cols());
> }
>
> Cheers,
> Benoit
>
>
>