Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <Eigen/Dense>
3 
4 using namespace std;
5 using namespace Eigen;
6 int 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 }
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Definition: Half.h:150
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:51:19