mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #1071: improve doc on lpNorm and add example for some operator norms
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user