Re: [eigen] cast ArrayXd* to ArrayXXd* (comparision 2D>1D)

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



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
> 




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