#include <iostream>
#include <Eigen/Dense>
◆ main()
5 Eigen::MatrixXf
mat(2, 4);
6 mat << 1, 2, 6, 9, 3, 1, 7, 2;
9 float maxNorm =
mat.colwise().
sum().maxCoeff(&maxIndex);
11 std::cout <<
"Maximum sum at position " << maxIndex << std::endl;
13 std::cout <<
"The corresponding vector is: " << std::endl;
14 std::cout <<
mat.col(maxIndex) << std::endl;
15 std::cout <<
"And its sum is is: " << maxNorm << std::endl;
Eigen::SparseMatrix< double > mat
Definition: EigenUnitTest.cpp:10
Scalar sum() const
Definition: SparseRedux.h:30
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
References Eigen::SparseMatrix< Scalar_, Options_, StorageIndex_ >::sum().