Skip to content

Instantly share code, notes, and snippets.

@EricCousineau-TRI
Created August 23, 2017 14:22
Show Gist options
  • Save EricCousineau-TRI/b894a3425157f3c91c2b00ea33068d46 to your computer and use it in GitHub Desktop.
Save EricCousineau-TRI/b894a3425157f3c91c2b00ea33068d46 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main() {
MatrixXd A(2, 2);
A << 1, 2, 3, 4;
cout << A << endl << endl;
A.resize(4, 1);
cout << A << endl << endl;
MatrixXd B(2, 2);
B << 1, 2, 3, 4;
cout << B << endl << endl;
B.conservativeResize(4, 1);
cout << B << endl << endl;
return 0;
}
/*
Output:
1 2
3 4
1
3
2
4
1 2
3 4
1
3
0
0
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment