bug #1071: improve doc on lpNorm and add example for some operator norms

This commit is contained in:
Gael Guennebaud
2015-09-28 11:55:36 +02:00
parent 8c1ee3629f
commit 02e940fc9f
3 changed files with 35 additions and 4 deletions

View File

@@ -0,0 +1,18 @@
#include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
m << 1,-2,
-3,4;
cout << "1-norm(m) = " << m.cwiseAbs().colwise().sum().maxCoeff()
<< " == " << m.colwise().lpNorm<1>().maxCoeff() << endl;
cout << "infty-norm(m) = " << m.cwiseAbs().rowwise().sum().maxCoeff()
<< " == " << m.rowwise().lpNorm<1>().maxCoeff() << endl;
}