Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp
Go to the documentation of this file.
1 #include <Eigen/Dense>
2 #include <iostream>
3 
4 int main()
5 {
6  Eigen::MatrixXf m(2,2);
7  m << 1,-2,
8  -3,4;
9 
10  std::cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
11  << " == " << m.colwise().lpNorm<1>().maxCoeff() << std::endl;
12 
13  std::cout << "infty-norm(m) = " << m.cwiseAbs().rowwise().sum().maxCoeff()
14  << " == " << m.rowwise().lpNorm<1>().maxCoeff() << std::endl;
15 }
Matrix3f m
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182