|Re: [eigen] cast ArrayXd* to ArrayXXd*|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] cast ArrayXd* to ArrayXXd*
- From: Holger Herrlich <holgerherrlich05@xxxxxxxx>
- Date: Wed, 03 Oct 2012 14:23:52 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1349267076; bh=gXBsLa/AMl+Q1s7imi7EoQ4iPlcD3H2kkug51U2bu8s=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=UX7d8RcaJ+OjVN9Fe64o/LxLDXfKqddXnmazBEXxPx6c/Fb6sWYDhhn+dPYf6hTWE cN+6rorO8xdEZaz0iPXg6ndlOaaAWD0bU5hFl85bFOynRVCXVF1bHw13vjp5bWbxqE +tiYTlvC42VqGELg12WZLTbmJVQLLiJRR+PyiA8U=
Hi, i eventually choose to use parameter by reference instead of
allocating myself. Besides that this is (marginally) faster than return
values and it matches on overloading. Also guess it's kinda state of the
art in C++.
I will not direct access the methods but copy into a NumPy-Array such
that the values are owned by Python. However that wasn't clear at the
beginning. Cause of that I avoided "call by reference" guessing to have
to create the array previously at Python.
On 10/02/2012 11:35 PM, Christoph Hertzberg wrote:
> On 26.09.2012 18:48, Holger Herrlich wrote:
>> I finally needed it to run this: (and can avoid casting)
>> a1_2D->colwise() = *a1_1D;
>> *a2_2D = a2_2D->binaryExpr( *a1_2D, ptr_fun<double,double,double>(fn));
>> Well, I choose to use "new" because I don't know the array size at
>> calling the function. Also avoided the call by reference parameter while
>> it was not that clear how the interface to python looks like later on.
> There is a resize(rows, cols) method and instead of returning a pointer,
> you can return an ArrayXd by value and hope for good-enough RVO (return
> value optimization).
> If you need the pointer interface, because of Python, I'm afraid I can't
> help much ...