Re: [eigen] Array question (maybe a bug)

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


oops, that's fixed now.

gael

On Mon, Jan 18, 2010 at 6:37 PM, Trevor Irons <trevorirons@xxxxxxxxx> wrote:
> Is this expected?
>
> #include "Eigen/Core"
> #include "Eigen/Array"
>
> using namespace Eigen;
>
> int main() {
>     VectorXd y(3);
>     double rams=1.25;
>     VectorXd kk(4);
>     kk << 0.1, -0.1, -0.1, .1;
>     y    =  rams-kk.array();        // Wrong answer
>     //y  =  -kk.array()+rams;    // OK
>     for (int i=0; i<4; ++i) {
>         std::cout << y[i] << "\t" << (rams - kk[i]) << std::endl;
>     }
>     return 0;
> }
>
> Returns, where I was thinking they would be equivalent.
>
> tirons@baboon:~/sandbox/eigen$ ./min
> -1.15    1.15
> -1.35    1.35
> -1.35    1.35
> -1.15    1.15
>
> I get the expected answer with   -kk.array() - rams.
> Is this a bug, or am I missing something with how array's work?
>
> Thanks,
> Trevor
>



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