Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <Eigen/Dense>
3 
4 int main()
5 {
6  Eigen::MatrixXf m(2,2);
7 
8  m << 1, 2,
9  3, 4;
10 
11  //get location of maximum
12  Eigen::Index maxRow, maxCol;
13  float max = m.maxCoeff(&maxRow, &maxCol);
14 
15  //get location of minimum
16  Eigen::Index minRow, minCol;
17  float min = m.minCoeff(&minRow, &minCol);
18 
19  std::cout << "Max: " << max << ", at: " <<
20  maxRow << "," << maxCol << std::endl;
21  std:: cout << "Min: " << min << ", at: " <<
22  minRow << "," << minCol << std::endl;
23 }
Matrix3f m
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
bfloat16() max(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:690
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:684
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82