Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp File Reference

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 4 of file Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp.

5 {
6  Eigen::MatrixXf mat(2,4);
7  mat << 1, 2, 6, 9,
8  3, 1, 7, 2;
9 
10  Eigen::Index maxIndex;
11  float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
12 
13  std::cout << "Maximum sum at position " << maxIndex << std::endl;
14 
15  std::cout << "The corresponding vector is: " << std::endl;
16  std::cout << mat.col( maxIndex ) << std::endl;
17  std::cout << "And its sum is is: " << maxNorm << std::endl;
18 }
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82