Line | |
---|
1 | #include <Eigen/Dense>
|
---|
2 | #include <iostream>
|
---|
3 |
|
---|
4 | using namespace Eigen;
|
---|
5 | using namespace std;
|
---|
6 |
|
---|
7 | int main(int, char**)
|
---|
8 | {
|
---|
9 | cout.precision(3);
|
---|
10 | MatrixXd m(2,3);
|
---|
11 | m << 1,2,3,4,5,6;
|
---|
12 | cout << "here's the 2x3 matrix m:" << endl << m << endl;
|
---|
13 | cout << "let's resize m to 3x2. This is a conservative resizing because 2*3==3*2." << endl;
|
---|
14 | m.resize(3,2);
|
---|
15 | cout << "here's the 3x2 matrix m:" << endl << m << endl;
|
---|
16 | cout << "now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:" << endl;
|
---|
17 | m.resize(2,2);
|
---|
18 | cout << m << endl;
|
---|
19 |
|
---|
20 | return 0;
|
---|
21 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.