Home | History | Annotate | Download | only in snippets
      1 MatrixXd m(2,3);
      2 m << 1,2,3,4,5,6;
      3 cout << "here's the 2x3 matrix m:" << endl << m << endl;
      4 cout << "let's resize m to 3x2. This is a conservative resizing because 2*3==3*2." << endl;
      5 m.resize(3,2);
      6 cout << "here's the 3x2 matrix m:" << endl << m << endl;
      7 cout << "now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:" << endl;
      8 m.resize(2,2);
      9 cout << m << endl;
     10