libsemigroups  v3.6.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
matrix-fmt.hpp
1//
2// libsemigroups - C++ library for semigroups and monoids
3// Copyright (C) 2026 James D. Mitchell
4//
5// This program is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <http://www.gnu.org/licenses/>.
17//
18
19#ifndef LIBSEMIGROUPS_MATRIX_FMT_HPP_
20#define LIBSEMIGROUPS_MATRIX_FMT_HPP_
21
22#include <algorithm> // for max_element
23#include <cstddef> // for size_t
24#include <ostream> // for operator<<, basic_...
25#include <sstream> // for basic_ostringstream
26#include <string> // for basic_string, string
27#include <type_traits> // for enable_if_t
28#include <vector> // for vector
29
30#include "exception.hpp" // for LIBSEMIGROUPS_EXCE...
31#include "is-matrix.hpp" // for IsMatrix
32#include "matrix-helpers.hpp" // for rows
33
34#include "detail/fmt.hpp" // for format
35#include "detail/matrix-common.hpp" // for entry_repr
36#include "detail/string.hpp" // for unicode_string_length
37
38namespace libsemigroups {
39 namespace detail {
40 // Forward decl.
41 template <typename Mat, typename Subclass>
42 class RowViewCommon;
43 } // namespace detail
44
57 template <typename Mat, typename Subclass>
59 detail::RowViewCommon<Mat, Subclass> const& x);
60
77 template <typename Mat>
78 auto operator<<(std::ostringstream& os, Mat const& x)
79 -> std::enable_if_t<IsMatrix<Mat>, std::ostringstream&>;
80
97 template <typename Mat>
98 [[nodiscard]] auto to_human_readable_repr(Mat const& x,
99 std::string const& prefix,
100 std::string const& short_name = "",
101 std::string const& braces = "{}",
102 size_t max_width = 72)
103 -> std::enable_if_t<IsMatrix<Mat>, std::string>;
104} // namespace libsemigroups
105
106#include "matrix-fmt.tpp"
107#endif // LIBSEMIGROUPS_MATRIX_FMT_HPP_
std::string to_human_readable_repr(Action< Element, Point, Func, Traits, LeftOrRight > const &action)
Return a human readable representation of an Action object.
Namespace for everything in the libsemigroups library.
Definition action.hpp:44