Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <Eigen/Dense>
00003 
00004 using namespace std;
00005 using namespace Eigen;
00006 int main()
00007 {
00008   MatrixXf mat(2,4);
00009   mat << 1, 2, 6, 9,
00010          3, 1, 7, 2;
00011   
00012   MatrixXf::Index   maxIndex;
00013   float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
00014   
00015   std::cout << "Maximum sum at position " << maxIndex << std::endl;
00016 
00017   std::cout << "The corresponding vector is: " << std::endl;
00018   std::cout << mat.col( maxIndex ) << std::endl;
00019   std::cout << "And its sum is is: " << maxNorm << std::endl;
00020 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:27