Re: [eigen] Strange initialization

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


2010/7/10 Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>:
> Could someone please explain why the second initialization
> below is accepted and what it is doing?
>
> Many thanks,
> Helmut.
>
>
> #include <iostream>
> #include <Eigen/Core>
>
> using Eigen::Matrix2i;   using Eigen::Map;
>
> int main() {
>  int data[4] = {1, 2, 3, 4};
> // This works as documented
>  Map<Matrix2i> m2x2(data,2,2);
>  std::cout << m2x2 << std::endl;
>
> // but what happens here ?
>  Matrix2i mat2x2(data);  // accepted but
>  std::cout << mat2x2 << std::endl;
> /* output    0  3
>             0  4
> */
> }

I can't reproduce this with gcc 4.4, for me your test program always
prints as expected:

1 3
2 4
1 3
2 4

I have tried
 - eigen2 and eigen3
 - with and without vectorization
 - with and without -O2

What compiler and command line are you using?

Benoit

>
>
> --
> Helmut Jarausch
>
> Lehrstuhl fuer Numerische Mathematik
> RWTH - Aachen University
> D 52056 Aachen, Germany
>
>
>
>



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