Created
August 23, 2017 14:22
-
-
Save EricCousineau-TRI/b894a3425157f3c91c2b00ea33068d46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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