"vscode:/vscode.git/clone" did not exist on "aa73c64c0429c69bae41ae74477fa247563cf909"
Tutorial_ArrayClass_interop.cpp 400 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <Eigen/Dense>
#include <iostream>

using Eigen::MatrixXf;

int main() {
  MatrixXf m(2, 2);
  MatrixXf n(2, 2);
  MatrixXf result(2, 2);

  m << 1, 2, 3, 4;
  n << 5, 6, 7, 8;

  result = (m.array() + 4).matrix() * m;
  std::cout << "-- Combination 1: --\n" << result << "\n\n";
  result = (m.array() * n.array()).matrix() * m;
  std::cout << "-- Combination 2: --\n" << result << "\n\n";
}