• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <iostream>
2 #include <Eigen/Dense>
3 
4 using namespace std;
5 using namespace Eigen;
6 
main()7 int main()
8 {
9   Eigen::MatrixXf m(2,2);
10 
11   m << 1, 2,
12        3, 4;
13 
14   //get location of maximum
15   MatrixXf::Index maxRow, maxCol;
16   float max = m.maxCoeff(&maxRow, &maxCol);
17 
18   //get location of minimum
19   MatrixXf::Index minRow, minCol;
20   float min = m.minCoeff(&minRow, &minCol);
21 
22   cout << "Max: " << max <<  ", at: " <<
23      maxRow << "," << maxCol << endl;
24   cout << "Min: " << min << ", at: " <<
25      minRow << "," << minCol << endl;
26 }
27