cart-elc

Source code for CART-ELC
git clone git://git.laack.co/cart-elc.git
Log | Files | Refs | README | LICENSE

Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp (447B)


      1 #include <Eigen/Dense>
      2 #include <iostream>
      3 
      4 using namespace Eigen;
      5 using namespace std;
      6 
      7 int main()
      8 {
      9   MatrixXf m(2,2);
     10   m << 1,-2,
     11        -3,4;
     12 
     13   cout << "1-norm(m)     = " << m.cwiseAbs().colwise().sum().maxCoeff()
     14        << " == "             << m.colwise().lpNorm<1>().maxCoeff() << endl;
     15 
     16   cout << "infty-norm(m) = " << m.cwiseAbs().rowwise().sum().maxCoeff()
     17        << " == "             << m.rowwise().lpNorm<1>().maxCoeff() << endl;
     18 }