libsemigroups  v3.6.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
matrix-exceptions.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_EXCEPTIONS_HPP_
20#define LIBSEMIGROUPS_MATRIX_EXCEPTIONS_HPP_
21
22#include <algorithm> // for find_if_not
23#include <string> // for basic_string
24#include <type_traits> // for enable_if_t
25
26#include "constants.hpp" // for POSITIVE_INFINITY
27#include "exception.hpp" // for LIBSEMIGROUPS_EXCEPTION
28#include "is-matrix.hpp" // for IsMatrix
29#include "matrix-helpers.hpp" // for threshold, period
30
31#include "detail/matrix-common.hpp" // for entry_repr
32#include "detail/matrix-exceptions.hpp" // for throw_if_semiring_nullptr
33
34namespace libsemigroups::matrix {
35
50 template <typename Mat>
51 auto throw_if_bad_entry(Mat const& x) -> std::enable_if_t<IsIntMat<Mat>>;
52
71 // NOTE this function isn't used and so should be deleted
72 template <typename Mat>
73 [[deprecated]] auto throw_if_bad_entry(Mat const&,
74 typename Mat::scalar_type val)
75 -> std::enable_if_t<IsIntMat<Mat>>;
76
93 template <typename Mat>
94 auto throw_if_bad_entry(Mat const& m) -> std::enable_if_t<IsBMat<Mat>>;
95
115 // NOTE this function isn't used and so should be deleted
116 template <typename Mat>
117 [[deprecated]] auto throw_if_bad_entry(Mat const&,
118 typename Mat::scalar_type val)
119 -> std::enable_if_t<IsBMat<Mat>>;
120
136 template <typename Mat>
137 auto throw_if_bad_entry(Mat const& x) -> std::enable_if_t<IsMaxPlusMat<Mat>>;
138
156 // NOTE this function isn't used and so should be deleted
157 template <typename Mat>
158 [[deprecated]] auto throw_if_bad_entry(Mat const&,
159 typename Mat::scalar_type val)
160 -> std::enable_if_t<IsMaxPlusMat<Mat>>;
161
177 template <typename Mat>
178 auto throw_if_bad_entry(Mat const& x) -> std::enable_if_t<IsMinPlusMat<Mat>>;
179
197 // NOTE this function isn't used and so should be deleted
198 template <typename Mat>
199 [[deprecated]] auto throw_if_bad_entry(Mat const&,
200 typename Mat::scalar_type val)
201 -> std::enable_if_t<IsMinPlusMat<Mat>>;
202
221 template <typename Mat>
222 auto throw_if_bad_entry(Mat const& m)
223 -> std::enable_if_t<IsMaxPlusTruncMat<Mat>>;
224
246 // NOTE this function isn't used and so should be deleted
247 template <typename Mat>
248 [[deprecated]] auto throw_if_bad_entry(Mat const& m,
249 typename Mat::scalar_type val)
250 -> std::enable_if_t<IsMaxPlusTruncMat<Mat>>;
251
270 template <typename Mat>
271 auto throw_if_bad_entry(Mat const& m)
272 -> std::enable_if_t<IsMinPlusTruncMat<Mat>>;
273
295 // NOTE this function isn't used and so should be deleted
296 template <typename Mat>
297 [[deprecated]] auto throw_if_bad_entry(Mat const& m,
298 typename Mat::scalar_type val)
299 -> std::enable_if_t<IsMinPlusTruncMat<Mat>>;
300
321 template <typename Mat>
322 auto throw_if_bad_entry(Mat const& m) -> std::enable_if_t<IsNTPMat<Mat>>;
323
345 template <typename Mat>
346 [[deprecated]] auto throw_if_bad_entry(Mat const& m,
347 typename Mat::scalar_type val)
348 -> std::enable_if_t<IsNTPMat<Mat>>;
349
367 template <typename Mat>
368 auto throw_if_bad_entry(Mat const& x)
369 -> std::enable_if_t<IsProjMaxPlusMat<Mat>> {
370 throw_if_bad_entry(x.underlying_matrix());
371 }
372
390 template <typename Mat>
391 [[deprecated]] auto throw_if_bad_entry(Mat const& x,
392 typename Mat::scalar_type val)
393 -> std::enable_if_t<IsProjMaxPlusMat<Mat>> {
394 throw_if_bad_entry(x.underlying_matrix(), val);
395 }
396} // namespace libsemigroups::matrix
397
398#include "matrix-exceptions.tpp"
399#endif // LIBSEMIGROUPS_MATRIX_EXCEPTIONS_HPP_
auto throw_if_bad_entry(Mat const &x) -> std::enable_if_t< IsIntMat< Mat > >
Check that an integer matrix is valid.
Namespace for helper functions for matrices.
Definition matrix-exceptions.hpp:37