mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 18:19:34 +08:00
35 lines
503 B
C++
35 lines
503 B
C++
#include <Eigen/Dense>
|
|
#include <iostream>
|
|
|
|
using namespace Eigen;
|
|
using namespace std;
|
|
|
|
int main()
|
|
{
|
|
ArrayXXf m(2,2);
|
|
ArrayXXf n(2,2);
|
|
|
|
ArrayXXf result(2,2);
|
|
|
|
//initialize arrays
|
|
m << 1,2,
|
|
3,4;
|
|
|
|
n << 5,6,
|
|
7,8;
|
|
|
|
|
|
// --> array multiplication
|
|
result = m * n;
|
|
|
|
cout << "-- Array m*n: --" << endl
|
|
<< result << endl << endl;
|
|
|
|
|
|
// --> Matrix multiplication
|
|
result = m.matrix() * n.matrix();
|
|
|
|
cout << "-- Matrix m*n: --" << endl
|
|
<< result << endl << endl;
|
|
}
|