aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp~
blob: 03057f8d2bd0905d53432351fa3f578edf76822e (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 << 2,
       5;
  
  m << 0,2,
       3,4;

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