Tutorial_ArrayClass_interop_matrix.cpp File Reference

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 6 of file Tutorial_ArrayClass_interop_matrix.cpp.

7 {
8  MatrixXf m(2,2);
9  MatrixXf n(2,2);
10  MatrixXf result(2,2);
11 
12  m << 1,2,
13  3,4;
14  n << 5,6,
15  7,8;
16 
17  result = m * n;
18  std::cout << "-- Matrix m*n: --\n" << result << "\n\n";
19  result = m.array() * n.array();
20  std::cout << "-- Array m*n: --\n" << result << "\n\n";
21  result = m.cwiseProduct(n);
22  std::cout << "-- With cwiseProduct: --\n" << result << "\n\n";
23  result = m.array() + 4;
24  std::cout << "-- Array m + 4: --\n" << result << "\n\n";
25 }
Matrix3f m
int n
Matrix< float, Dynamic, Dynamic > MatrixXf
Dynamic×Dynamic matrix of type float.
Definition: Matrix.h:501