14template <std::
floating_po
int F>
16 std::array<char, 64> buf;
20template <std::
floating_po
int F>
21void print_elem(std::span<char> buf, F value, std::ostream &os) {
25template <std::
integral I>
30template <std::
floating_po
int F>
31void print_elem(std::span<char> buf, std::complex<F> value, std::ostream &os) {
41 using index_t =
decltype(M)::index_type;
43 std::array<char, 64> buf;
46 os << indent << opts.
start;
47 for (index_t r = 0; r < M.
rows(); ++r) {
48 for (index_t c = 0; c < M.
cols(); ++c) {
50 if (r != M.
rows() - 1 || c != M.
cols() - 1)
54 return os << opts.
end;
56 for (index_t r = 0; r < M.
rows(); ++r) {
58 for (index_t c = 0; c < M.
cols(); ++c) {
60 if (c != M.
cols() - 1)
63 if (r != M.
rows() - 1)
66 return os << opts.
end;
72 std::string_view end) {
94 std::string_view end,
bool squeeze) {
96 if ((M.
cols() == 1 && squeeze) || (M.
rows() == 1 && squeeze))
109 .column_vector_as_1d =
false,
110 .row_vector_as_1d =
false,
index_type cols() const noexcept
index_type rows() const noexcept
std::string_view line_start
std::string_view line_end
std::string_view delimiter
std::string_view float_to_str_vw(std::span< char > buf, F value, int precision=std::numeric_limits< F >::max_digits10)
std::string float_to_str(F value, int precision)
std::ostream & print_csv_impl(std::ostream &os, PrintMatrixView< const T > M, PrintOpts opts)
std::ostream & print_matlab_impl(std::ostream &os, PrintMatrixView< const T > M, std::string_view end)
std::ostream & print_python_impl(std::ostream &os, PrintMatrixView< const T > M, std::string_view end, bool squeeze)
void print_elem(std::span< char > buf, F value, std::ostream &os)
Matrix/vector printing helpers and float formatting.