libsemigroups
v3.6.3
C++ library for semigroups and monoids
Toggle main menu visibility
Loading...
Searching...
No Matches
matrix-adapters.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_ADAPTERS_HPP_
20
#define LIBSEMIGROUPS_MATRIX_ADAPTERS_HPP_
21
22
#include <cstddef>
// for size_t
23
#include <type_traits>
// for enable_if_t
24
25
#include "adapters.hpp"
// for Complexity etc
26
#include "debug.hpp"
// for LIBSEMIGROUPS_ASSERT
27
#include "is-matrix.hpp"
// for IsMatrix
28
29
namespace
libsemigroups
{
30
45
56
template
<
typename
Mat>
57
struct
Complexity
<Mat,
std
::enable_if_t<IsMatrix<Mat>>> {
71
[[nodiscard]]
constexpr
size_t
operator()
(Mat
const
& x)
const
noexcept
{
72
return
x.number_of_rows() * x.number_of_rows() * x.number_of_rows();
73
}
74
};
75
86
template
<
typename
Mat>
87
struct
Degree
<Mat,
std
::enable_if_t<IsMatrix<Mat>>> {
100
[[nodiscard]]
constexpr
size_t
operator()
(Mat
const
& x)
const
noexcept
{
101
return
x.number_of_rows();
102
}
103
};
104
115
template
<
typename
Mat>
116
struct
Hash
<Mat,
std
::enable_if_t<IsMatrix<Mat>>> {
129
[[nodiscard]]
constexpr
size_t
operator()
(Mat
const
& x)
const
{
130
return
x.hash_value();
131
}
132
};
133
149
template
<
typename
Mat>
150
struct
IncreaseDegree
<Mat,
std
::enable_if_t<IsMatrix<Mat>>> {
154
constexpr
void
operator()
(Mat&,
size_t
)
const
noexcept
{
155
// static_assert(false, "Cannot increase degree for Matrix");
156
LIBSEMIGROUPS_ASSERT(
false
);
157
}
158
};
159
173
template
<
typename
Mat>
174
struct
One
<Mat,
std
::enable_if_t<IsMatrix<Mat>>> {
188
[[nodiscard]]
inline
Mat
operator()
(Mat
const
& x)
const
{
189
return
x.one();
190
}
191
};
192
203
template
<
typename
Mat>
204
struct
Product
<Mat,
std
::enable_if_t<IsMatrix<Mat>>> {
223
inline
void
224
operator()
(Mat& xy, Mat
const
& x, Mat
const
& y,
size_t
= 0)
const
{
225
xy.product_inplace_no_checks(x, y);
226
}
227
};
228
}
// namespace libsemigroups
229
#endif
// LIBSEMIGROUPS_MATRIX_ADAPTERS_HPP_
libsemigroups
Namespace for everything in the libsemigroups library.
Definition
action.hpp:44
std
libsemigroups::Complexity< Mat, std::enable_if_t< IsMatrix< Mat > > >::operator()
constexpr size_t operator()(Mat const &x) const noexcept
Call operator.
Definition
matrix-adapters.hpp:71
libsemigroups::Complexity
Adapter for the complexity of multiplication.
Definition
adapters.hpp:128
libsemigroups::Degree< Mat, std::enable_if_t< IsMatrix< Mat > > >::operator()
constexpr size_t operator()(Mat const &x) const noexcept
Call operator.
Definition
matrix-adapters.hpp:100
libsemigroups::Degree
Adapter for the degree of an element.
Definition
adapters.hpp:166
libsemigroups::Hash< Mat, std::enable_if_t< IsMatrix< Mat > > >::operator()
constexpr size_t operator()(Mat const &x) const
Call operator.
Definition
matrix-adapters.hpp:129
libsemigroups::Hash
Adapter for hashing.
Definition
adapters.hpp:451
libsemigroups::IncreaseDegree< Mat, std::enable_if_t< IsMatrix< Mat > > >::operator()
constexpr void operator()(Mat &, size_t) const noexcept
Call operator.
Definition
matrix-adapters.hpp:154
libsemigroups::IncreaseDegree
Adapter for increasing the degree of an element.
Definition
adapters.hpp:206
libsemigroups::One< Mat, std::enable_if_t< IsMatrix< Mat > > >::operator()
Mat operator()(Mat const &x) const
Call operator.
Definition
matrix-adapters.hpp:188
libsemigroups::One
Adapter for the identity element of the given type.
Definition
adapters.hpp:251
libsemigroups::Product< Mat, std::enable_if_t< IsMatrix< Mat > > >::operator()
void operator()(Mat &xy, Mat const &x, Mat const &y, size_t=0) const
Call operator.
Definition
matrix-adapters.hpp:224
libsemigroups::Product
Adapter for the product of two elements.
Definition
adapters.hpp:289
include
libsemigroups
matrix-adapters.hpp
Generated by
1.18.0