aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
blob: f3364d7fce30b4c44b15ad8d6bf1ae3e88063836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <Eigen/Dense>
#include <iostream>

using namespace std;
using namespace Eigen;

int main()
{
  VectorXf v(2);
  MatrixXf m(2,2), n(2,2);
  
  v << 5,
       10;
  
  m << 2,2,
       3,4;

  n << 1, 2,
       32,12;
  
  cout << "v.norm() = " << v.norm() << endl;
  cout << "m.norm() = " << m.norm() << endl;
  cout << "n.norm() = " << n.norm() << endl;
  cout << endl;
  cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
  cout << "m.squaredNorm() = " << m.squaredNorm() << endl;
  cout << "n.squaredNorm() = " << n.squaredNorm() << endl;
}