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

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

Doc

File size: 502 bytes
Line 
1#include <iostream>
2#include <Eigen/Dense>
3
4using namespace std;
5using namespace Eigen;
6int main()
7{
8 MatrixXf mat(2,4);
9 mat << 1, 2, 6, 9,
10 3, 1, 7, 2;
11
12 MatrixXf::Index maxIndex;
13 float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
14
15 std::cout << "Maximum sum at position " << maxIndex << std::endl;
16
17 std::cout << "The corresponding vector is: " << std::endl;
18 std::cout << mat.col( maxIndex ) << std::endl;
19 std::cout << "And its sum is is: " << maxNorm << std::endl;
20}
Note: See TracBrowser for help on using the repository browser.