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: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Mon, 2 Feb 2009 01:43:23 +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=Ox9FZDf1p527Y+jAKvygJHVBIUnoQjDgN/dVoW7g2/c=; b=b3fdHKT0Jq3mc8xbq6ruJ7udDgndzZkiIxqAJREOKxbO1Pru8933pTsRFcXcBWuYX9 vxe4hlPMP9Wk+bTv3rz8Sa5NoQKWQBniTe4MHjwr+dpnbb8ItK9uf+XY7gDZiDMjCn+z 0p54WHC5rC0hF5DiJyna+a6H/g5km5Jq4QJ0E=
- 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=Ucrr7zIxURjJFNlfq0xFBRLCO1NvakR7rbPPUWij3qrOiX5N7IOQbUxBL2KjT7aTAt P4DKpkkPpQUgTrJ9MqjmEVg4oJlQq0HdlNmI/GjsVeIoglhTz+/KlJv9TYncE6Wah124 Z71VX1VbQLh1KyNLjuXSm42uxGa/xLtZPr1Mk=
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