eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp~

29 lines
554 B
C++

#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;
}