source: pacpussensors/trunk/Vislab/lib3dv/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 531 bytes
Line 
1#include <iostream>
2#include <Eigen/Dense>
3
4using namespace std;
5using namespace Eigen;
6
7int 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}
Note: See TracBrowser for help on using the repository browser.