Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
Go to the documentation of this file.
1 #include <Eigen/Dense>
2 #include <iostream>
3 
4 int main()
5 {
7  Eigen::MatrixXf m(2,2), n(2,2);
8 
9  v << -1,
10  2;
11 
12  m << 1,-2,
13  -3,4;
14 
15  std::cout << "v.squaredNorm() = " << v.squaredNorm() << std::endl;
16  std::cout << "v.norm() = " << v.norm() << std::endl;
17  std::cout << "v.lpNorm<1>() = " << v.lpNorm<1>() << std::endl;
18  std::cout << "v.lpNorm<Infinity>() = " << v.lpNorm<Eigen::Infinity>() << std::endl;
19 
20  std::cout << std::endl;
21  std::cout << "m.squaredNorm() = " << m.squaredNorm() << std::endl;
22  std::cout << "m.norm() = " << m.norm() << std::endl;
23  std::cout << "m.lpNorm<1>() = " << m.lpNorm<1>() << std::endl;
24  std::cout << "m.lpNorm<Infinity>() = " << m.lpNorm<Eigen::Infinity>() << std::endl;
25 }
Matrix3f m
Array< int, Dynamic, 1 > v
int n
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
const int Infinity
Definition: Constants.h:38