source: pacpussensors/trunk/Vislab/lib3dv/eigen/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 591 bytes
Line 
1#include <Eigen/Dense>
2#include <iostream>
3
4using namespace Eigen;
5using namespace std;
6
7int main()
8{
9 MatrixXf m(2,2);
10 MatrixXf n(2,2);
11 MatrixXf result(2,2);
12
13 m << 1,2,
14 3,4;
15 n << 5,6,
16 7,8;
17
18 result = m * n;
19 cout << "-- Matrix m*n: --" << endl << result << endl << endl;
20 result = m.array() * n.array();
21 cout << "-- Array m*n: --" << endl << result << endl << endl;
22 result = m.cwiseProduct(n);
23 cout << "-- With cwiseProduct: --" << endl << result << endl << endl;
24 result = m.array() + 4;
25 cout << "-- Array m + 4: --" << endl << result << endl << endl;
26}
Note: See TracBrowser for help on using the repository browser.