source: pacpussensors/trunk/Vislab/lib3dv/eigen/Eigen-install/doc/snippets/compile_tut_arithmetic_redux_minmax.cpp@ 136

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

Doc

File size: 643 bytes
Line 
1#include <Eigen/Dense>
2#include <iostream>
3
4using namespace Eigen;
5using namespace std;
6
7int main(int, char**)
8{
9 cout.precision(3);
10 Matrix3f m = Matrix3f::Random();
11 std::ptrdiff_t i, j;
12 float minOfM = m.minCoeff(&i,&j);
13 cout << "Here is the matrix m:\n" << m << endl;
14 cout << "Its minimum coefficient (" << minOfM
15 << ") is at position (" << i << "," << j << ")\n\n";
16
17 RowVector4i v = RowVector4i::Random();
18 int maxOfV = v.maxCoeff(&i);
19 cout << "Here is the vector v: " << v << endl;
20 cout << "Its maximum coefficient (" << maxOfV
21 << ") is at position " << i << endl;
22
23 return 0;
24}
Note: See TracBrowser for help on using the repository browser.