I am trying to print Eigen::Array or Eigen::Matrix with c++20 format, instead of Eigen::IOFormat. I would like to control the precision and alignment of elements in the matrix with specifiers, for example,
#include <Eigen/Core>
#include <format>
#include <iostream>
int main()
{
Eigen::ArrayXXd mat( 3, 4 );
mat.setZero();
std::cout << std::format( "mat={:9.4f}\n", mat );
return 0;
}
How can I get the following expected result?
mat= 0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000
0.0000 0.0000 0.0000 0.0000