Tutorial_ArrayClass_addition.cpp
Go to the documentation of this file.
1 #include <Eigen/Dense>
2 #include <iostream>
3 
4 int main()
5 {
6  Eigen::ArrayXXf a(3,3);
7  Eigen::ArrayXXf b(3,3);
8  a << 1,2,3,
9  4,5,6,
10  7,8,9;
11  b << 1,2,3,
12  1,2,3,
13  1,2,3;
14 
15  // Adding two arrays
16  std::cout << "a + b = " << std::endl << a + b << std::endl << std::endl;
17 
18  // Subtracting a scalar from an array
19  std::cout << "a - 2 = " << std::endl << a - 2 << std::endl;
20 }
Array< int, 3, 1 > b
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:49