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 | MatrixXi mat(3,3);
|
---|
11 | mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
|
---|
12 | cout << "Here is the matrix mat:\n" << mat << endl;
|
---|
13 |
|
---|
14 | // The eval() solves the aliasing problem
|
---|
15 | mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval();
|
---|
16 | cout << "After the assignment, mat = \n" << mat << endl;
|
---|
17 |
|
---|
18 | return 0;
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.