[eigen] Strange initialization

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


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
*/
}


-- 
Helmut Jarausch

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




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