xref: /aosp_15_r20/external/eigen/doc/snippets/IOFormat.cpp (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li std::string sep = "\n----------------------------------------\n";
2*bf2c3715SXin Li Matrix3d m1;
3*bf2c3715SXin Li m1 << 1.111111, 2, 3.33333, 4, 5, 6, 7, 8.888888, 9;
4*bf2c3715SXin Li 
5*bf2c3715SXin Li IOFormat CommaInitFmt(StreamPrecision, DontAlignCols, ", ", ", ", "", "", " << ", ";");
6*bf2c3715SXin Li IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]");
7*bf2c3715SXin Li IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]");
8*bf2c3715SXin Li IOFormat HeavyFmt(FullPrecision, 0, ", ", ";\n", "[", "]", "[", "]");
9*bf2c3715SXin Li 
10*bf2c3715SXin Li std::cout << m1 << sep;
11*bf2c3715SXin Li std::cout << m1.format(CommaInitFmt) << sep;
12*bf2c3715SXin Li std::cout << m1.format(CleanFmt) << sep;
13*bf2c3715SXin Li std::cout << m1.format(OctaveFmt) << sep;
14*bf2c3715SXin Li std::cout << m1.format(HeavyFmt) << sep;
15