1 #include <Eigen/Dense> 2 #include <iostream> 3 4 using namespace std; 5 using namespace Eigen; 6 main()7int main() 8 { 9 VectorXf v(2); 10 MatrixXf m(2,2), n(2,2); 11 12 v << -1, 13 2; 14 15 m << 1,-2, 16 -3,4; 17 18 cout << "v.squaredNorm() = " << v.squaredNorm() << endl; 19 cout << "v.norm() = " << v.norm() << endl; 20 cout << "v.lpNorm<1>() = " << v.lpNorm<1>() << endl; 21 cout << "v.lpNorm<Infinity>() = " << v.lpNorm<Infinity>() << endl; 22 23 cout << endl; 24 cout << "m.squaredNorm() = " << m.squaredNorm() << endl; 25 cout << "m.norm() = " << m.norm() << endl; 26 cout << "m.lpNorm<1>() = " << m.lpNorm<1>() << endl; 27 cout << "m.lpNorm<Infinity>() = " << m.lpNorm<Infinity>() << endl; 28 } 29