Re: [eigen] cast ArrayXd* to ArrayXXd* (comparision 2D>1D) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] cast ArrayXd* to ArrayXXd* (comparision 2D>1D)
- From: Holger Herrlich <holgerherrlich05@xxxxxxxx>
- Date: Fri, 28 Sep 2012 17:09:49 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=arcor.de; s=mail-in; t=1348845036; bh=j8Fy+0aEFPp1qO7Q/PVq5IFpRD5/VH7Y+tY/V94SFvA=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Bsm06l6rQSzZtTu622azM5Mj8rBBtWQlX4dmWr1JLtqoHv9boRtPVUcSEqkurf0ZX szqzj4VvndIFQ15MPKWyvFAKglSTgYH64qGS0nYn4e43mvksk912DFfTnlRlBrcuOZ YPfKdKs0Wg54L+dROqvIuXD87b6YBLncch8MgMKE=
Is here a way to make this comparison work?
Lg Holger
----8<---8<----
#include <iostream>
#include <Eigen/Core>
using namespace std;
int main() {
Eigen::ArrayXXd arr2D;
Eigen::ArrayXd arr1D;
Eigen::ArrayXXd True;
Eigen::ArrayXXd False;
arr2D = Eigen::ArrayXXd::Random(3,5);
arr1D = Eigen::ArrayXd:: Random(3);
cout << ":1a:" << endl << arr2D << endl
<< ":1b:" << endl << arr1D << endl;
True = Eigen::ArrayXXd::Ones(3,5);
False = Eigen::ArrayXXd::Zero(3,5);
cout << ":2a:" << endl << (arr2D.colwise()+arr1D) << endl; // works
cout << ":2b:" << endl << (arr2D.colwise()>arr1D) << endl; // fails
// arr2D = ( arr2D>arr1D ).select( True, False ); //fails at runtime
// cout << ":3:" << endl << arr2D << endl;
return 0;
}
----8<---8<----
On 09/26/2012 02:50 PM, Holger Herrlich wrote:
>
> Hi, did I really have to:
>
> Eigen::ArrayXXd* smInt;
> Eigen::ArrayXd* tmp = fn_create();
> smInt = new Eigen::ArrayXXd( *(tmp) );
> delete(tmp.arrayXd);
>
> to cast from Array<double,len> to Array<double,len,1> when using pointers?
>
>
> Regards Holger
>