Rev | Line | |
---|
[136] | 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 | Matrix<int, 3, 4, ColMajor> Acolmajor;
|
---|
| 11 | Acolmajor << 8, 2, 2, 9,
|
---|
| 12 | 9, 1, 4, 4,
|
---|
| 13 | 3, 5, 4, 5;
|
---|
| 14 | cout << "The matrix A:" << endl;
|
---|
| 15 | cout << Acolmajor << endl << endl;
|
---|
| 16 |
|
---|
| 17 | cout << "In memory (column-major):" << endl;
|
---|
| 18 | for (int i = 0; i < Acolmajor.size(); i++)
|
---|
| 19 | cout << *(Acolmajor.data() + i) << " ";
|
---|
| 20 | cout << endl << endl;
|
---|
| 21 |
|
---|
| 22 | Matrix<int, 3, 4, RowMajor> Arowmajor = Acolmajor;
|
---|
| 23 | cout << "In memory (row-major):" << endl;
|
---|
| 24 | for (int i = 0; i < Arowmajor.size(); i++)
|
---|
| 25 | cout << *(Arowmajor.data() + i) << " ";
|
---|
| 26 | cout << endl;
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | return 0;
|
---|
| 30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.