Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <Eigen/Dense>
3 
4 using namespace std;
5 using namespace Eigen;
6 
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 }
Matrix3f m
#define max(a, b)
Definition: datatypes.h:20
#define min(a, b)
Definition: datatypes.h:19
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Definition: BFloat16.h:88
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:40:38