source: pacpussensors/trunk/Vislab/lib3dv/eigen/Eigen-install/doc/snippets/compile_IOFormat.cpp@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 780 bytes
Line 
1#include <Eigen/Dense>
2#include <iostream>
3
4using namespace Eigen;
5using namespace std;
6
7int main(int, char**)
8{
9 cout.precision(3);
10 std::string sep = "\n----------------------------------------\n";
11Matrix3d m1;
12m1 << 1.111111, 2, 3.33333, 4, 5, 6, 7, 8.888888, 9;
13
14IOFormat CommaInitFmt(StreamPrecision, DontAlignCols, ", ", ", ", "", "", " << ", ";");
15IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]");
16IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]");
17IOFormat HeavyFmt(FullPrecision, 0, ", ", ";\n", "[", "]", "[", "]");
18
19std::cout << m1 << sep;
20std::cout << m1.format(CommaInitFmt) << sep;
21std::cout << m1.format(CleanFmt) << sep;
22std::cout << m1.format(OctaveFmt) << sep;
23std::cout << m1.format(HeavyFmt) << sep;
24
25 return 0;
26}
Note: See TracBrowser for help on using the repository browser.