Re: [eigen] New true array class ?

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


Quoting Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:

2010/1/27 Boris Mansencal <boris.mansencal@xxxxxxxx>:

- How do we declare a vector and apply sin() to it ?
 The following code does not compile (with both branches) :
 Eigen::ArrayXd v1(N);
 //...
 Eigen::ArrayXd v2 = sin(v1);

Hm it's either std::sin (so make sure you have using namespace std) or
ei_sin or v1.sin();

thanks, v1.sin() works but neither std::sin(v1) nor eis_in(v1) works.

Maybe I do something wrong. See my attached very simple example.

Boris.

// g++ -Wall -Wextra -O3 -DNDEBUG  -march=native -mtune=native  -o test test1.cpp -I/home/mansencal/tools/eigen

#include <cmath>
#include <iostream>

#include <Eigen/Core>

int
main()
{
  Eigen::ArrayXd v1(10);
  for (int i=0; i<v1.size(); ++i)
    v1[i] = i;

  Eigen::ArrayXd v2 = std::sin(v1);
  //Eigen::ArrayXd v2 = ei_sin(v1);
  //Eigen::ArrayXd v2 = v1.sin();

  for (int i=0; i<v2.size(); ++i)
    std::cerr<<v2[i]<<" ";
  std::cerr<<std::endl;

  return 0;
}


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