21#ifndef LIBSEMIGROUPS_MATRIX_CLASS_HPP_
22#define LIBSEMIGROUPS_MATRIX_CLASS_HPP_
27#include <initializer_list>
33#include <unordered_map>
34#include <unordered_set>
38#include "adapters.hpp"
40#include "constants.hpp"
42#include "exception.hpp"
43#include "is-matrix.hpp"
44#include "matrix-view.hpp"
46#include "detail/containers.hpp"
47#include "detail/matrix-common.hpp"
48#include "detail/matrix-exceptions.hpp"
49#include "detail/string.hpp"
161 template <
typename PlusOp,
170 MatrixStaticArithmetic<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>,
171 public detail::MatrixCommon<
172 std::array<Scalar, R * C>,
173 StaticMatrix<PlusOp, ProdOp, ZeroOp, OneOp, R, C, Scalar>,
174 StaticRowView<PlusOp, ProdOp, ZeroOp, OneOp, C, Scalar>> {
179 using MatrixCommon = ::libsemigroups::detail::MatrixCommon<
312 "cannot construct Matrix with more than one row from RowView!");
342#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
350 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
359 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
366 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
372 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
381#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
857 template <typename T>
946 template <typename U>
947 bool operator<=(U const& that) const;
963 template <typename U>
964 bool operator>=(U const& that) const;
1033 using MatrixCommon::at;
1034 using MatrixCommon::begin;
1035 using MatrixCommon::cbegin;
1036 using MatrixCommon::cend;
1037 using MatrixCommon::coords;
1038 using MatrixCommon::end;
1039 using MatrixCommon::hash_value;
1040 using MatrixCommon::number_of_cols;
1041 using MatrixCommon::number_of_rows;
1042 using MatrixCommon::one;
1043 using MatrixCommon::operator!=;
1044 using MatrixCommon::operator();
1045 using MatrixCommon::operator*;
1046 using MatrixCommon::operator*=;
1047 using MatrixCommon::operator+;
1048 using MatrixCommon::operator+=;
1049 using MatrixCommon::operator<;
1050 using MatrixCommon::operator<=;
1051 using MatrixCommon::operator==;
1052 using MatrixCommon::operator>;
1053 using MatrixCommon::operator>=;
1054 using MatrixCommon::product_inplace_no_checks;
1055 using MatrixCommon::row;
1056 using MatrixCommon::row_no_checks;
1057 using MatrixCommon::rows;
1058 using MatrixCommon::scalar_one;
1059 using MatrixCommon::scalar_zero;
1060 using MatrixCommon::semiring;
1061 using MatrixCommon::swap;
1062 using MatrixCommon::transpose;
1063 using MatrixCommon::transpose_no_checks;
1071 static constexpr size_t number_of_rows_impl() noexcept {
1074 static constexpr size_t number_of_cols_impl() noexcept {
1116 template <
typename PlusOp,
1122 :
public detail::MatrixDynamicDim<Scalar>,
1123 public detail::MatrixCommon<
1124 std::vector<Scalar>,
1125 DynamicMatrix<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>,
1126 DynamicRowView<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>>,
1128 MatrixStaticArithmetic<PlusOp, ProdOp, ZeroOp, OneOp, Scalar> {
1129 using MatrixDynamicDim = ::libsemigroups::detail::MatrixDynamicDim<Scalar>;
1130 using MatrixCommon = ::libsemigroups::detail::MatrixCommon<
1133 DynamicRowView<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>>;
1134 friend MatrixCommon;
1153 using RowView = DynamicRowView<PlusOp, ProdOp, ZeroOp, OneOp, Scalar>;
1243 : MatrixDynamicDim(1, c.size()), MatrixCommon(c) {}
1267 : MatrixDynamicDim(m.size(),
std::empty(m) ? 0 : m.
begin()->size()),
1285 : MatrixDynamicDim(m.size(),
std::empty(m) ? 0 : m.
begin()->size()),
1300 : MatrixDynamicDim(1, rv.size()), MatrixCommon(rv) {}
1302#ifndef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1304 DynamicMatrix(
void const* ptr,
size_t r,
size_t c) : DynamicMatrix(r, c) {
1306 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
1311 : DynamicMatrix(c) {
1313 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
1319 std::initializer_list<std::initializer_list<scalar_type>>
const& m)
1320 : DynamicMatrix(m) {
1322 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
1325 static DynamicMatrix
one(
void const* ptr,
size_t n) {
1327 LIBSEMIGROUPS_ASSERT(ptr ==
nullptr);
1346 std::fill(x.begin(), x.end(), ZeroOp()());
1347 for (
size_t r = 0; r < n; ++r) {
1348 x(r, r) = OneOp()();
1353#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1455 template <typename T>
1456 bool operator<=(T const& that) const;
1468 template <typename T>
1469 bool operator>=(T const& that) const;
1485 template <typename T>
1503 using MatrixCommon::at;
1504 using MatrixCommon::begin;
1505 using MatrixCommon::cbegin;
1506 using MatrixCommon::cend;
1507 using MatrixCommon::coords;
1508 using MatrixCommon::end;
1509 using MatrixCommon::hash_value;
1510 using MatrixCommon::number_of_cols;
1511 using MatrixCommon::number_of_rows;
1512 using MatrixCommon::one;
1513 using MatrixCommon::operator!=;
1514 using MatrixCommon::operator();
1515 using MatrixCommon::operator*;
1516 using MatrixCommon::operator*=;
1517 using MatrixCommon::operator+;
1518 using MatrixCommon::operator+=;
1519 using MatrixCommon::operator<;
1520 using MatrixCommon::operator<=;
1521 using MatrixCommon::operator==;
1522 using MatrixCommon::operator>;
1523 using MatrixCommon::operator>=;
1524 using MatrixCommon::product_inplace_no_checks;
1525 using MatrixCommon::row;
1526 using MatrixCommon::row_no_checks;
1527 using MatrixCommon::rows;
1528 using MatrixCommon::scalar_one;
1529 using MatrixCommon::scalar_zero;
1530 using MatrixCommon::semiring;
1532 using MatrixCommon::transpose;
1533 using MatrixCommon::transpose_no_checks;
1538 static_cast<MatrixDynamicDim&
>(*this).swap(
1539 static_cast<MatrixDynamicDim&
>(that));
1540 static_cast<MatrixCommon&
>(*this).swap(
static_cast<MatrixCommon&
>(that));
1544 using MatrixCommon::resize;
1585 template <
typename Semiring,
typename Scalar>
1587 :
public detail::MatrixDynamicDim<Scalar>,
1588 public detail::MatrixCommon<std::vector<Scalar>,
1589 DynamicMatrix<Semiring, Scalar>,
1590 DynamicRowView<Semiring, Scalar>,
1592 using MatrixCommon = detail::MatrixCommon<std::vector<Scalar>,
1594 DynamicRowView<Semiring, Scalar>,
1596 friend MatrixCommon;
1597 using MatrixDynamicDim = ::libsemigroups::detail::MatrixDynamicDim<Scalar>;
1657 : MatrixDynamicDim(r, c), MatrixCommon(), _semiring(sr) {
1697 : MatrixDynamicDim(rws.size(), (rws.empty() ? 0 : rws.
begin()->size())),
1716 : MatrixDynamicDim(1, rw.size()), MatrixCommon(rw), _semiring(sr) {}
1730 : MatrixDynamicDim(1, rv.size()),
1732 _semiring(rv._matrix->
semiring()) {}
1753#ifdef LIBSEMIGROUPS_PARSED_BY_DOXYGEN
1843 template <typename T>
1844 bool operator<=(T const& that) const;
1856 template <typename T>
1857 bool operator>=(T const& that) const;
1873 template <typename T>
1891 using MatrixCommon::at;
1892 using MatrixCommon::begin;
1893 using MatrixCommon::cbegin;
1894 using MatrixCommon::cend;
1895 using MatrixCommon::coords;
1896 using MatrixCommon::end;
1897 using MatrixCommon::hash_value;
1898 using MatrixCommon::number_of_cols;
1899 using MatrixCommon::number_of_rows;
1900 using MatrixCommon::one;
1901 using MatrixCommon::operator!=;
1902 using MatrixCommon::operator();
1903 using MatrixCommon::operator*;
1904 using MatrixCommon::operator*=;
1905 using MatrixCommon::operator+;
1906 using MatrixCommon::operator+=;
1907 using MatrixCommon::operator<;
1908 using MatrixCommon::operator<=;
1909 using MatrixCommon::operator==;
1910 using MatrixCommon::operator>;
1911 using MatrixCommon::operator>=;
1912 using MatrixCommon::product_inplace_no_checks;
1913 using MatrixCommon::row;
1914 using MatrixCommon::row_no_checks;
1915 using MatrixCommon::rows;
1916 using MatrixCommon::scalar_one;
1917 using MatrixCommon::scalar_zero;
1918 using MatrixCommon::semiring;
1920 using MatrixCommon::transpose;
1921 using MatrixCommon::transpose_no_checks;
1928 using MatrixCommon::resize;
1932 return _semiring->plus_no_checks(x, y);
1935 scalar_type product_no_checks_impl(scalar_type x,
1936 scalar_type y)
const noexcept {
1937 return _semiring->product_no_checks(x, y);
1940 scalar_type one_impl() const noexcept {
1941 return _semiring->scalar_one();
1944 scalar_type zero_impl() const noexcept {
1945 return _semiring->scalar_zero();
1948 Semiring
const* semiring_impl() const noexcept {
1952 Semiring
const* _semiring;
1961 template <
typename PlusOp,
1968 struct IsStaticMatrixHelper<
1969 StaticMatrix<PlusOp, ProdOp, ZeroOp, OneOp, R, C, Scalar>>
1970 : std::true_type {};
1972 template <
typename Semiring,
typename Scalar>
1973 struct IsMatWithSemiringHelper<DynamicMatrix<Semiring, Scalar>>
1974 : std::true_type {};
2131 = DynamicMatrix<BooleanPlus, BooleanProd, BooleanZero, BooleanOne, int>;
2144 template <
size_t R,
size_t C>
2167 template <
size_t R = 0,
size_t C = R>
2169 = std::conditional_t<R == 0 || C == 0, DynamicBMat, StaticBMat<R, C>>;
2172 template <
size_t R,
size_t C>
2223 template <
typename Scalar>
2237 constexpr Scalar
operator()(Scalar x, Scalar y)
const noexcept {
2254 template <
typename Scalar>
2268 constexpr Scalar
operator()(Scalar x, Scalar y)
const noexcept {
2282 template <
typename Scalar>
2293 constexpr Scalar
operator()() const noexcept {
2307 template <
typename Scalar>
2318 constexpr Scalar
operator()() const noexcept {
2333 template <
typename Scalar>
2356 template <
size_t R,
size_t C,
typename Scalar>
2381 template <
size_t R = 0,
size_t C = R,
typename Scalar =
int>
2382 using IntMat = std::conditional_t<R == 0 || C == 0,
2386 template <
size_t R,
size_t C,
typename Scalar>
2389 template <
typename Scalar>
2449 template <
typename Scalar>
2452 "MaxPlus requires a signed integer type as parameter!");
2465 Scalar
operator()(Scalar x, Scalar y)
const noexcept;
2489 template <
typename Scalar>
2492 "MaxPlus requires a signed integer type as parameter!");
2505 Scalar
operator()(Scalar x, Scalar y)
const noexcept;
2521 template <
typename Scalar>
2524 "MaxPlus requires a signed integer type as parameter!");
2534 constexpr Scalar
operator()() const noexcept {
2549 template <
typename Scalar>
2568 template <
size_t R,
size_t C,
typename Scalar>
2592 template <
size_t R = 0,
size_t C = R,
typename Scalar =
int>
2593 using MaxPlusMat = std::conditional_t<R == 0 || C == 0,
2598 template <
size_t R,
size_t C,
typename Scalar>
2602 template <
typename Scalar>
2661 template <
typename Scalar>
2664 "MinPlus requires a signed integer type as parameter!");
2677 Scalar
operator()(Scalar x, Scalar y)
const noexcept;
2701 template <
typename Scalar>
2704 "MinPlus requires a signed integer type as parameter!");
2717 Scalar
operator()(Scalar x, Scalar y)
const noexcept;
2733 template <
typename Scalar>
2736 "MinPlus requires a signed integer type as parameter!");
2746 constexpr Scalar
operator()() const noexcept {
2761 template <
typename Scalar>
2780 template <
size_t R,
size_t C,
typename Scalar>
2804 template <
size_t R = 0,
size_t C = R,
typename Scalar =
int>
2805 using MinPlusMat = std::conditional_t<R == 0 || C == 0,
2810 template <
size_t R,
size_t C,
typename Scalar>
2814 template <
typename Scalar>
2893 template <
size_t T,
typename Scalar>
2896 "MaxPlus requires a signed integer type as parameter!");
2909 Scalar
operator()(Scalar x, Scalar y)
const noexcept;
2926 template <
typename Scalar =
int>
2929 "MaxPlus requires a signed integer type as parameter!");
2982 static constexpr Scalar
scalar_one() noexcept {
3069 Scalar
const _threshold;
3084 template <
size_t T,
typename Scalar>
3104 template <
size_t T,
size_t R,
size_t C,
typename Scalar>
3130 template <
size_t T = 0,
size_t R = 0,
size_t C = R,
typename Scalar =
int>
3133 std::conditional_t<T == 0,
3134 DynamicMatrix<MaxPlusTruncSemiring<Scalar>, Scalar>,
3139 template <
size_t T,
size_t R,
size_t C,
typename Scalar>
3142 static constexpr Scalar threshold = T;
3145 template <
size_t T,
typename Scalar>
3148 static constexpr Scalar threshold = T;
3151 template <
typename Scalar>
3152 struct IsMaxPlusTruncMatHelper<
3154 static constexpr Scalar threshold =
UNDEFINED;
3157 template <
typename T>
3158 struct IsTruncMatHelper<T,
std::enable_if_t<IsMaxPlusTruncMat<T>>>
3160 static constexpr typename T::scalar_type threshold
3161 = IsMaxPlusTruncMatHelper<T>::threshold;
3239 template <
size_t T,
typename Scalar>
3253 Scalar
operator()(Scalar x, Scalar y)
const noexcept;
3269 template <
typename Scalar =
int>
3272 "MinPlus requires an integral type as parameter!");
3323 static constexpr Scalar
scalar_one() noexcept {
3411 Scalar
const _threshold;
3426 template <
size_t T,
typename Scalar>
3446 template <
size_t T,
size_t R,
size_t C,
typename Scalar>
3473 template <
size_t T = 0,
size_t R = 0,
size_t C = R,
typename Scalar =
int>
3476 std::conditional_t<T == 0,
3477 DynamicMatrix<MinPlusTruncSemiring<Scalar>, Scalar>,
3482 template <
size_t T,
size_t R,
size_t C,
typename Scalar>
3485 static constexpr Scalar threshold = T;
3488 template <
size_t T,
typename Scalar>
3491 static constexpr Scalar threshold = T;
3494 template <
typename Scalar>
3495 struct IsMinPlusTruncMatHelper<
3497 static constexpr Scalar threshold =
UNDEFINED;
3500 template <
typename T>
3501 struct IsTruncMatHelper<T,
std::enable_if_t<IsMinPlusTruncMat<T>>>
3503 static constexpr typename T::scalar_type threshold
3504 = IsMinPlusTruncMatHelper<T>::threshold;
3566 template <
size_t T,
size_t P,
typename Scalar>
3567 constexpr Scalar thresholdperiod(Scalar x)
noexcept;
3569 template <
typename Scalar>
3570 inline Scalar thresholdperiod(Scalar x,
3572 Scalar period)
noexcept;
3598 template <
size_t T,
size_t P,
typename Scalar>
3611 constexpr Scalar
operator()(Scalar x, Scalar y)
const noexcept {
3612 return detail::thresholdperiod<T, P>(x + y);
3639 template <
size_t T,
size_t P,
typename Scalar>
3654 constexpr Scalar
operator()(Scalar x, Scalar y)
const noexcept {
3655 return detail::thresholdperiod<T, P>(x * y);
3673 template <
typename Scalar =
size_t>
3716 NTPSemiring(Scalar t, Scalar p) : _period(p), _threshold(t) {
3720 "expected non-negative value for 1st argument, found {}", t);
3725 "expected positive value for 2nd argument, found {}", p);
3739 static constexpr Scalar
scalar_one() noexcept {
3784 LIBSEMIGROUPS_ASSERT(x >= 0 && x <= _period + _threshold - 1);
3785 LIBSEMIGROUPS_ASSERT(y >= 0 && y <= _period + _threshold - 1);
3786 return detail::thresholdperiod(x * y, _threshold, _period);
3814 LIBSEMIGROUPS_ASSERT(x >= 0 && x <= _period + _threshold - 1);
3815 LIBSEMIGROUPS_ASSERT(y >= 0 && y <= _period + _threshold - 1);
3816 return detail::thresholdperiod(x + y, _threshold, _period);
3847 Scalar
period() const noexcept {
3866 template <
typename Scalar>
3882 template <
size_t T,
size_t P,
typename Scalar>
3908 template <
size_t T,
size_t P,
size_t R,
size_t C,
typename Scalar>
3939 template <
size_t T = 0,
3943 typename Scalar =
size_t>
3944 using NTPMat = std::conditional_t<
3946 std::conditional_t<T == 0 && P == 0,
3952 template <
typename Scalar>
3954 static constexpr Scalar threshold =
UNDEFINED;
3955 static constexpr Scalar period =
UNDEFINED;
3958 template <
size_t T,
size_t P,
typename Scalar>
3961 static constexpr Scalar threshold = T;
3962 static constexpr Scalar period = P;
3965 template <
size_t T,
size_t P,
size_t R,
size_t C,
typename Scalar>
3967 static constexpr Scalar threshold = T;
3968 static constexpr Scalar period = P;
3971 template <
typename T>
3973 static constexpr typename T::scalar_type threshold
3974 = IsNTPMatHelper<T>::threshold;
3975 static constexpr typename T::scalar_type period
3976 = IsNTPMatHelper<T>::period;
3985 template <
typename T>
3988 using scalar_type =
typename T::scalar_type;
3989 using scalar_reference =
typename T::scalar_reference;
3990 using scalar_const_reference =
typename T::scalar_const_reference;
3991 using semiring_type = void;
3993 using container_type =
typename T::container_type;
3994 using iterator =
typename T::iterator;
3995 using const_iterator =
typename T::const_iterator;
3997 using underlying_matrix_type = T;
3999 using RowView =
typename T::RowView;
4005 using Row =
typename T::Row;
4007 scalar_type scalar_one() const noexcept {
4008 return _underlying_mat.scalar_one();
4011 scalar_type scalar_zero() const noexcept {
4012 return _underlying_mat.scalar_zero();
4026 : _is_normalized(false), _underlying_mat(r, c) {}
4030 typename underlying_matrix_type::semiring_type
const* semiring,
4033 : _is_normalized(false), _underlying_mat(semiring, r, c) {}
4035 explicit ProjMaxPlusMat(std::vector<std::vector<scalar_type>>
const& m)
4036 : _is_normalized(false), _underlying_mat(m) {
4041 std::initializer_list<std::initializer_list<scalar_type>>
const& m)
4043 std::vector<std::vector<scalar_type>>(m.begin(), m.end())) {}
4045 ~ProjMaxPlusMat() =
default;
4062 return _underlying_mat == that._underlying_mat;
4066 return !(_underlying_mat == that._underlying_mat);
4072 return _underlying_mat < that._underlying_mat;
4076 return that < *
this;
4079 template <
typename Thing>
4080 bool operator>=(Thing
const& that)
const {
4082 return that < *
this || that == *
this;
4086 template <
typename Thing>
4087 bool operator<=(Thing
const& that)
const {
4089 return *
this < that || that == *
this;
4096 scalar_reference operator()(
size_t r,
size_t c) {
4101 _is_normalized =
false;
4102 return _underlying_mat(r, c);
4105 scalar_reference at(
size_t r,
size_t c) {
4107 return this->operator()(r, c);
4110 scalar_const_reference operator()(
size_t r,
size_t c)
const {
4112 return _underlying_mat(r, c);
4115 scalar_const_reference at(
size_t r,
size_t c)
const {
4117 return this->operator()(r, c);
4120 size_t number_of_rows() const noexcept {
4121 return _underlying_mat.number_of_rows();
4124 size_t number_of_cols() const noexcept {
4125 return _underlying_mat.number_of_cols();
4128 size_t hash_value()
const {
4130 return Hash<T>()(_underlying_mat);
4139 _underlying_mat.product_inplace_no_checks(A._underlying_mat,
4145 _underlying_mat.product_inplace(A._underlying_mat, B._underlying_mat);
4150 _underlying_mat.plus_inplace_no_checks(that._underlying_mat);
4155 _underlying_mat += that._underlying_mat;
4160 _underlying_mat.product_inplace_no_checks(that._underlying_mat);
4164 void operator*=(scalar_type a) {
4165 _underlying_mat *= a;
4169 void operator+=(scalar_type a) {
4170 _underlying_mat += a;
4174 void operator+=(RowView a) {
4175 _underlying_mat += a;
4197 plus_no_checks(_underlying_mat, that._underlying_mat));
4206 product_no_checks(_underlying_mat, that._underlying_mat));
4221 iterator begin() noexcept {
4226 _is_normalized =
false;
4227 return _underlying_mat.begin();
4230 iterator end() noexcept {
4235 _is_normalized =
false;
4236 return _underlying_mat.end();
4239 const_iterator begin() const noexcept {
4241 return _underlying_mat.begin();
4244 const_iterator end() const noexcept {
4246 return _underlying_mat.end();
4249 const_iterator cbegin() const noexcept {
4251 return _underlying_mat.cbegin();
4254 const_iterator cend() const noexcept {
4256 return _underlying_mat.cend();
4264 std::swap(_underlying_mat, that._underlying_mat);
4268 _underlying_mat.transpose();
4271 void transpose_no_checks() noexcept {
4272 _underlying_mat.transpose_no_checks();
4279 RowView row(
size_t i)
const {
4281 return _underlying_mat.row(i);
4284 template <
typename C>
4285 void rows(C& x)
const {
4287 return _underlying_mat.rows(x);
4294 friend std::ostream& operator<<(std::ostream& os,
4297 os << detail::to_string(x._underlying_mat);
4301 T
const& underlying_matrix() const noexcept {
4303 return _underlying_mat;
4308 : _is_normalized(false), _underlying_mat(std::
move(mat)) {
4312 void normalize(
bool force =
false)
const;
4314 mutable bool _is_normalized;
4315 mutable T _underlying_mat;
4377 template <
size_t R,
size_t C,
typename Scalar>
4379 = detail::ProjMaxPlusMat<StaticMaxPlusMat<R, C, Scalar>>;
4392 template <
typename Scalar>
4394 = detail::ProjMaxPlusMat<DynamicMaxPlusMat<Scalar>>;
4410 template <
size_t R = 0,
size_t C = R,
typename Scalar =
int>
4416 template <
size_t R,
size_t C,
typename Scalar>
4420 template <
typename Scalar>
4444 template <
typename Mat>
4445 auto operator+(
typename Mat::scalar_type a, Mat
const& x)
4446 -> std::enable_if_t<IsMatrix<Mat>, Mat> {
4469 template <
typename Mat>
4470 auto operator*(
typename Mat::scalar_type a, Mat
const& x)
4471 -> std::enable_if_t<IsMatrix<Mat>, Mat> {
4479 std::enable_if_t<libsemigroups::IsMatrix<Mat>>>
4480 inline void swap(Mat& x, Mat& y)
noexcept {
4485#include "matrix-class.tpp"
DynamicMatrix(std::initializer_list< scalar_type > const &c)
Construct a vector from a std::initializer_list.
Definition matrix-class.hpp:1242
DynamicMatrix(std::initializer_list< std::initializer_list< scalar_type > > const &m)
Construct a matrix from std::initializer_list of std::initializer_list of scalars.
Definition matrix-class.hpp:1265
DynamicMatrix()=default
Default constructor.
DynamicMatrix & operator=(DynamicMatrix &&)=default
Default move assignment operator.
scalar_reference at(size_t r, size_t c)
Returns a reference to the specified entry of the matrix.
ProdOp Prod
Alias for the template parameter ProdOp.
Definition matrix-class.hpp:1159
void product_inplace_no_checks(DynamicMatrix const &x, DynamicMatrix const &y)
Multiplies x and y and stores the result in this.
DynamicMatrix & operator=(DynamicMatrix const &)=default
Default copy assignment operator.
DynamicMatrix Row
The type of a row of a DynamicMatrix.
Definition matrix-class.hpp:1150
PlusOp Plus
Alias for the template parameter PlusOp.
Definition matrix-class.hpp:1156
void rows(T &x) const
Add row views for every row in the matrix to a container.
scalar_type scalar_one() const noexcept
Returns the multiplicative identity of the underlying semiring.
typename MatrixCommon::scalar_const_reference scalar_const_reference
The type of const references to the entries in the matrix.
Definition matrix-class.hpp:1146
void swap(DynamicMatrix &that) noexcept
Swaps the contents of *this with the contents of that.
Definition matrix-class.hpp:1537
const_iterator cend() noexcept
Returns a const iterator pointing one beyond the last entry in the matrix.
static DynamicMatrix one(size_t n)
Construct the identity matrix.
Definition matrix-class.hpp:1344
DynamicMatrix(size_t r, size_t c)
Construct a matrix with given dimensions.
Definition matrix-class.hpp:1219
void product_inplace(DynamicMatrix const &x, DynamicMatrix const &y)
Multiplies x and y and stores the result in this.
ZeroOp Zero
Alias for the template parameter ZeroOp.
Definition matrix-class.hpp:1162
scalar_type scalar_zero() const noexcept
Returns the additive identity of the underlying semiring.
void transpose_no_checks()
Transpose a matrix in-place.
semiring_type const * semiring() const noexcept
Returns the underlying semiring.
OneOp One
Alias for the template parameter OneOp.
Definition matrix-class.hpp:1165
void semiring_type
Alias for the semiring type (void).
Definition matrix-class.hpp:1172
RowView row(size_t i) const
Returns a view into a row.
DynamicMatrix(RowView const &rv)
Construct a row from a row view.
Definition matrix-class.hpp:1299
iterator begin() noexcept
Returns an iterator pointing at the first entry.
size_t number_of_rows() const noexcept
Returns the number of rows of the matrix.
DynamicRowView< PlusOp, ProdOp, ZeroOp, OneOp, Scalar > RowView
The type of a row view into a DynamicMatrix.
Definition matrix-class.hpp:1153
void plus_inplace_no_checks(DynamicMatrix const &that)
Add a matrix to another matrix in-place.
DynamicMatrix product_no_checks(DynamicMatrix const &that)
Returns the product of two matrices.
RowView row_no_checks(size_t i) const
Returns a view into a row.
DynamicMatrix(std::vector< std::vector< scalar_type > > const &m)
Construct a matrix from std::vector of std::vector of scalars.
Definition matrix-class.hpp:1284
typename MatrixCommon::scalar_reference scalar_reference
The type of references to the entries in the matrix.
Definition matrix-class.hpp:1141
scalar_reference at(size_t r, size_t c) const
Returns a const reference to the specified entry of the matrix.
DynamicMatrix(DynamicMatrix const &)=default
Default copy constructor.
size_t hash_value() const
Return a hash value of a matrix.
const_iterator cbegin() noexcept
Returns a const iterator pointing at the first entry.
DynamicMatrix plus_no_checks(DynamicMatrix const &y) const
Returns the sum of two matrices.
DynamicMatrix(DynamicMatrix &&)=default
Default move constructor.
typename MatrixCommon::scalar_type scalar_type
The type of the entries in the matrix.
Definition matrix-class.hpp:1138
size_t number_of_cols() const noexcept
Returns the number of columns of the matrix.
void transpose()
Transpose a matrix in-place.
std::pair< scalar_type, scalar_type > coords(const_iterator it) const
Get the coordinates of an iterator.
iterator end() noexcept
Returns an iterator pointing one beyond the last entry in the matrix.
DynamicMatrix(Semiring const *sr, std::initializer_list< std::initializer_list< scalar_type > > const &rws)
Construct a matrix over a given semiring (std::initializer_list of std::initializer_list).
DynamicMatrix & operator=(DynamicMatrix &&)=default
Default move assignment operator.
static DynamicMatrix one(Semiring const *semiring, size_t n)
Construct the identity matrix.
scalar_reference at(size_t r, size_t c)
Returns a reference to the specified entry of the matrix.
DynamicMatrix(Semiring const *sr, std::vector< std::vector< scalar_type > > const &rws)
Construct a matrix over a given semiring (std::vector of std::vector).
Definition matrix-class.hpp:1695
DynamicMatrix(Semiring const *sr, size_t r, size_t c)
Construct a matrix over a given semiring with given dimensions.
Definition matrix-class.hpp:1656
void product_inplace_no_checks(DynamicMatrix const &x, DynamicMatrix const &y)
Multiplies x and y and stores the result in this.
DynamicMatrix & operator=(DynamicMatrix const &)=default
Default copy assignment operator.
DynamicMatrix Row
Alias for the type of the rows of a DynamicMatrix.
Definition matrix-class.hpp:1613
void rows(T &x) const
Add row views for every row in the matrix to a container.
scalar_type scalar_one() const noexcept
Returns the multiplicative identity of the underlying semiring.
typename MatrixCommon::scalar_const_reference scalar_const_reference
Alias for const references to the template parameter Scalar.
Definition matrix-class.hpp:1609
void swap(DynamicMatrix &that) noexcept
Swaps the contents of *this with the contents of that.
const_iterator cend() noexcept
Returns a const iterator pointing one beyond the last entry in the matrix.
void product_inplace(DynamicMatrix const &x, DynamicMatrix const &y)
Multiplies x and y and stores the result in this.
scalar_type scalar_zero() const noexcept
Returns the additive identity of the underlying semiring.
void transpose_no_checks()
Transpose a matrix in-place.
DynamicMatrix()=delete
Deleted.
semiring_type const * semiring() const noexcept
Returns the underlying semiring.
RowView row(size_t i) const
Returns a view into a row.
DynamicMatrix(RowView const &rv)
Construct a row over a given semiring (RowView).
Definition matrix-class.hpp:1729
iterator begin() noexcept
Returns an iterator pointing at the first entry.
size_t number_of_rows() const noexcept
Returns the number of rows of the matrix.
DynamicMatrix(Semiring const *sr, std::initializer_list< scalar_type > const &rw)
Construct a row over a given semiring (std::initializer_list).
Definition matrix-class.hpp:1714
void plus_inplace_no_checks(DynamicMatrix const &that)
Add a matrix to another matrix in-place.
DynamicMatrix product_no_checks(DynamicMatrix const &that)
Returns the product of two matrices.
RowView row_no_checks(size_t i) const
Returns a view into a row.
typename MatrixCommon::scalar_reference scalar_reference
Alias for references to the template parameter Scalar.
Definition matrix-class.hpp:1604
scalar_reference at(size_t r, size_t c) const
Returns a const reference to the specified entry of the matrix.
DynamicMatrix(DynamicMatrix const &)=default
Default copy constructor.
size_t hash_value() const
Return a hash value of a matrix.
const_iterator cbegin() noexcept
Returns a const iterator pointing at the first entry.
DynamicMatrix(DynamicMatrix &&)=default
Default move constructor.
typename MatrixCommon::scalar_type scalar_type
Alias for the template parameter Scalar.
Definition matrix-class.hpp:1601
DynamicRowView< Semiring, Scalar > RowView
Alias for the type of row views of a DynamicMatrix.
Definition matrix-class.hpp:1616
Semiring semiring_type
Alias for the template parameter Semiring.
Definition matrix-class.hpp:1621
size_t number_of_cols() const noexcept
Returns the number of columns of the matrix.
void transpose()
Transpose a matrix in-place.
std::pair< scalar_type, scalar_type > coords(const_iterator it) const
Get the coordinates of an iterator.
iterator end() noexcept
Returns an iterator pointing one beyond the last entry in the matrix.
Class representing a truncated max-plus semiring.
Definition matrix-class.hpp:2925
static constexpr Scalar scalar_zero() noexcept
Get the additive identity.
Definition matrix-class.hpp:2994
Scalar plus_no_checks(Scalar x, Scalar y) const noexcept
Addition in a truncated max-plus semiring.
Scalar product_no_checks(Scalar x, Scalar y) const noexcept
Multiplication in a truncated max-plus semiring.
MaxPlusTruncSemiring()=delete
Deleted default constructor.
Scalar threshold() const noexcept
Get the threshold.
Definition matrix-class.hpp:3062
static constexpr Scalar scalar_one() noexcept
Get the multiplicative identity.
Definition matrix-class.hpp:2980
Class representing a truncated min-plus semiring.
Definition matrix-class.hpp:3268
static constexpr Scalar scalar_zero() noexcept
Get the additive identity.
Definition matrix-class.hpp:3336
Scalar plus_no_checks(Scalar x, Scalar y) const noexcept
Addition in a truncated min-plus semiring.
Scalar product_no_checks(Scalar x, Scalar y) const noexcept
Multiplication in a truncated min-plus semiring.
Scalar threshold() const noexcept
Get the threshold.
Definition matrix-class.hpp:3404
static constexpr Scalar scalar_one() noexcept
Get the multiplicative identity.
Definition matrix-class.hpp:3321
MinPlusTruncSemiring()=delete
Deleted default constructor.
NTPSemiring & operator=(NTPSemiring const &)=default
Default copy assignment operator.
static constexpr Scalar scalar_zero() noexcept
Get the additive identity.
Definition matrix-class.hpp:3753
Scalar plus_no_checks(Scalar x, Scalar y) const noexcept
Addition in an ntp semiring.
Definition matrix-class.hpp:3811
NTPSemiring()=delete
Deleted default constructor.
Scalar product_no_checks(Scalar x, Scalar y) const noexcept
Multiplication in an ntp semiring.
Definition matrix-class.hpp:3781
Scalar period() const noexcept
Get the period.
Definition matrix-class.hpp:3845
Scalar threshold() const noexcept
Get the threshold.
Definition matrix-class.hpp:3829
static constexpr Scalar scalar_one() noexcept
Get the multiplicative identity.
Definition matrix-class.hpp:3737
Static matrix class.
Definition matrix-class.hpp:174
typename MatrixCommon::iterator iterator
Definition matrix-class.hpp:221
StaticMatrix(std::initializer_list< scalar_type > const &c)
Construct a row (from std::initializer_list).
typename MatrixCommon::const_iterator const_iterator
Definition matrix-class.hpp:224
scalar_const_reference at(size_t r, size_t c) const
Returns a const reference to the specified entry of the matrix.
scalar_reference at(size_t r, size_t c)
Returns a reference to the specified entry of the matrix.
ProdOp Prod
Definition matrix-class.hpp:212
PlusOp Plus
Definition matrix-class.hpp:209
scalar_type scalar_one() const noexcept
StaticMatrix(StaticMatrix &&)=default
Default move constructor.
typename MatrixCommon::scalar_const_reference scalar_const_reference
Alias for const references to the template parameter Scalar.
Definition matrix-class.hpp:199
void product_inplace(StaticMatrix const &x, StaticMatrix const &y)
static constexpr size_t nr_rows
Definition matrix-class.hpp:227
scalar_reference operator()(size_t r, size_t c)
Returns a reference to the specified entry of the matrix.
ZeroOp Zero
Definition matrix-class.hpp:215
scalar_type scalar_zero() const noexcept
void transpose_no_checks()
semiring_type const * semiring() const noexcept
void product_inplace_no_checks(StaticMatrix const &x, StaticMatrix const &y)
OneOp One
Definition matrix-class.hpp:218
StaticMatrix(std::initializer_list< std::initializer_list< scalar_type > > const &m)
Construct a matrix.
Definition matrix-class.hpp:273
StaticRowView< PlusOp, ProdOp, ZeroOp, OneOp, C, Scalar > RowView
Definition matrix-class.hpp:206
RowView row(size_t i) const
void swap(StaticMatrix &that) noexcept
static StaticMatrix one() const
Returns an identity matrix.
StaticMatrix(StaticMatrix const &)=default
Default copy constructor.
iterator begin() noexcept
Returns an iterator pointing at the first entry.
StaticMatrix(RowView const &rv)
Construct a row from a row view.
Definition matrix-class.hpp:309
size_t number_of_rows() const noexcept
StaticMatrix(std::vector< std::vector< scalar_type > > const &m)
Construct a matrix.
Definition matrix-class.hpp:289
StaticMatrix< PlusOp, ProdOp, ZeroOp, OneOp, 1, C, Scalar > Row
Alias for the type of the rows of a StaticMatrix.
Definition matrix-class.hpp:203
const_iterator cbegin() const noexcept
RowView row_no_checks(size_t i) const
StaticMatrix()=default
Default constructor.
typename MatrixCommon::scalar_reference scalar_reference
Alias for references to the template parameter Scalar.
Definition matrix-class.hpp:194
StaticMatrix product_no_checks(StaticMatrix const &that)
void plus_inplace_no_checks(StaticMatrix const &that)
size_t hash_value() const
StaticMatrix plus_no_checks(StaticMatrix const &y) const
typename MatrixCommon::scalar_type scalar_type
Alias for the template parameter Scalar.
Definition matrix-class.hpp:191
scalar_const_reference operator()(size_t r, size_t c) const
Returns a const reference to the specified entry of the matrix.
StaticMatrix & operator=(StaticMatrix &&)=default
Default move assignment operator.
size_t number_of_cols() const noexcept
StaticMatrix & operator=(StaticMatrix const &)=default
Default copy assignment operator.
std::pair< scalar_type, scalar_type > coords(const_iterator it) const
static constexpr size_t nr_cols
Definition matrix-class.hpp:230
Class for views into a row of a matrix over a semiring.
Definition matrix-view.hpp:92
Bipartition operator*(Bipartition const &x, Bipartition const &y)
Multiply two bipartitions.
StaticMatrix< BooleanPlus, BooleanProd, BooleanZero, BooleanOne, R, C, int > StaticBMat
Alias for static boolean matrices.
Definition matrix-class.hpp:2144
DynamicMatrix< BooleanPlus, BooleanProd, BooleanZero, BooleanOne, int > DynamicBMat
Alias for dynamic boolean matrices.
Definition matrix-class.hpp:2130
std::conditional_t< R==0||C==0, DynamicBMat, StaticBMat< R, C > > BMat
Alias template for boolean matrices.
Definition matrix-class.hpp:2167
NegativeInfinity const NEGATIVE_INFINITY
Value for negative infinity.
Undefined const UNDEFINED
Value for something undefined.
PositiveInfinity const POSITIVE_INFINITY
Value for positive infinity.
#define LIBSEMIGROUPS_EXCEPTION(...)
Throw a LibsemigroupsException.
Definition exception.hpp:99
StaticMatrix< IntegerPlus< Scalar >, IntegerProd< Scalar >, IntegerZero< Scalar >, IntegerOne< Scalar >, R, C, Scalar > StaticIntMat
Alias for static integer matrices.
Definition matrix-class.hpp:2355
std::conditional_t< R==0||C==0, DynamicIntMat< Scalar >, StaticIntMat< R, C, Scalar > > IntMat
Alias template for integer matrices.
Definition matrix-class.hpp:2380
DynamicMatrix< IntegerPlus< Scalar >, IntegerProd< Scalar >, IntegerZero< Scalar >, IntegerOne< Scalar >, Scalar > DynamicIntMat
Alias for dynamic integer matrices.
Definition matrix-class.hpp:2332
auto operator+(typename Mat::scalar_type a, Mat const &x) -> std::enable_if_t< IsMatrix< Mat >, Mat >
Add a scalar to a matrix.
Definition matrix-class.hpp:4441
constexpr bool IsMatrix
Helper variable template.
Definition is-matrix.hpp:87
std::conditional_t< R==0||C==0, DynamicMaxPlusMat< Scalar >, StaticMaxPlusMat< R, C, Scalar > > MaxPlusMat
Alias template for max-plus matrices.
Definition matrix-class.hpp:2591
StaticMatrix< MaxPlusPlus< Scalar >, MaxPlusProd< Scalar >, MaxPlusZero< Scalar >, IntegerZero< Scalar >, R, C, Scalar > StaticMaxPlusMat
Alias for static max-plus matrices.
Definition matrix-class.hpp:2567
DynamicMatrix< MaxPlusPlus< Scalar >, MaxPlusProd< Scalar >, MaxPlusZero< Scalar >, IntegerZero< Scalar >, Scalar > DynamicMaxPlusMat
Alias for dynamic max-plus matrices.
Definition matrix-class.hpp:2548
StaticMatrix< MaxPlusPlus< Scalar >, MaxPlusTruncProd< T, Scalar >, MaxPlusZero< Scalar >, IntegerZero< Scalar >, R, C, Scalar > StaticMaxPlusTruncMat
Alias for static truncated max-plus matrices.
Definition matrix-class.hpp:3103
DynamicMatrix< MaxPlusPlus< Scalar >, MaxPlusTruncProd< T, Scalar >, MaxPlusZero< Scalar >, IntegerZero< Scalar >, Scalar > DynamicMaxPlusTruncMat
Alias for dynamic truncated max-plus matrices.
Definition matrix-class.hpp:3083
std::conditional_t< R==0||C==0, std::conditional_t< T==0, DynamicMatrix< MaxPlusTruncSemiring< Scalar >, Scalar >, DynamicMaxPlusTruncMat< T, Scalar > >, StaticMaxPlusTruncMat< T, R, C, Scalar > > MaxPlusTruncMat
Alias template for truncated max-plus matrices.
Definition matrix-class.hpp:3129
DynamicMatrix< MinPlusPlus< Scalar >, MinPlusProd< Scalar >, MinPlusZero< Scalar >, IntegerZero< Scalar >, Scalar > DynamicMinPlusMat
Alias for dynamic min-plus matrices.
Definition matrix-class.hpp:2760
StaticMatrix< MinPlusPlus< Scalar >, MinPlusProd< Scalar >, MinPlusZero< Scalar >, IntegerZero< Scalar >, R, C, Scalar > StaticMinPlusMat
Alias for static min-plus matrices.
Definition matrix-class.hpp:2779
std::conditional_t< R==0||C==0, DynamicMinPlusMat< Scalar >, StaticMinPlusMat< R, C, Scalar > > MinPlusMat
Alias template for min-plus matrices.
Definition matrix-class.hpp:2803
std::conditional_t< R==0||C==0, std::conditional_t< T==0, DynamicMatrix< MinPlusTruncSemiring< Scalar >, Scalar >, DynamicMinPlusTruncMat< T, Scalar > >, StaticMinPlusTruncMat< T, R, C, Scalar > > MinPlusTruncMat
Alias template for truncated min-plus matrices.
Definition matrix-class.hpp:3472
DynamicMatrix< MinPlusPlus< Scalar >, MinPlusTruncProd< T, Scalar >, MinPlusZero< Scalar >, IntegerZero< Scalar >, Scalar > DynamicMinPlusTruncMat
Alias for dynamic truncated min-plus matrices.
Definition matrix-class.hpp:3425
StaticMatrix< MinPlusPlus< Scalar >, MinPlusTruncProd< T, Scalar >, MinPlusZero< Scalar >, IntegerZero< Scalar >, R, C, Scalar > StaticMinPlusTruncMat
Alias for static truncated min-plus matrices.
Definition matrix-class.hpp:3445
DynamicMatrix< NTPPlus< T, P, Scalar >, NTPProd< T, P, Scalar >, IntegerZero< Scalar >, IntegerOne< Scalar >, Scalar > DynamicNTPMatWithoutSemiring
Alias for ntp matrices with static threshold and period.
Definition matrix-class.hpp:3881
DynamicMatrix< NTPSemiring< Scalar >, Scalar > DynamicNTPMatWithSemiring
Alias for ntp matrices with dynamic threshold and period.
Definition matrix-class.hpp:3865
StaticMatrix< NTPPlus< T, P, Scalar >, NTPProd< T, P, Scalar >, IntegerZero< Scalar >, IntegerOne< Scalar >, R, C, Scalar > StaticNTPMat
Alias for ntp matrices with static threshold and period, and dimensions.
Definition matrix-class.hpp:3907
std::conditional_t< R==0||C==0, std::conditional_t< T==0 &&P==0, DynamicNTPMatWithSemiring< Scalar >, DynamicNTPMatWithoutSemiring< T, P, Scalar > >, StaticNTPMat< T, P, R, C, Scalar > > NTPMat
Alias template for ntp matrices.
Definition matrix-class.hpp:3942
std::conditional_t< R==0||C==0, DynamicProjMaxPlusMat< Scalar >, StaticProjMaxPlusMat< R, C, Scalar > > ProjMaxPlusMat
Alias template for projective max-plus matrices.
Definition matrix-class.hpp:4407
detail::ProjMaxPlusMat< DynamicMaxPlusMat< Scalar > > DynamicProjMaxPlusMat
Alias for dynamic projective max-plus matrices with run-time dimensions.
Definition matrix-class.hpp:4390
detail::ProjMaxPlusMat< StaticMaxPlusMat< R, C, Scalar > > StaticProjMaxPlusMat
Alias for static projective max-plus matrices with compile-time arithmetic and dimensions.
Definition matrix-class.hpp:4376
Bipartition one(Bipartition const &f)
Return the identity bipartition with the same degree as the given bipartition.
constexpr BMat8 transpose(BMat8 const &x) noexcept
Returns the transpose of a BMat8.
Definition bmat8.hpp:719
void throw_if_bad_coords(Mat const &x, size_t r, size_t c)
Throws the arguments do not index an entry of a matrix.
Namespace for everything in the libsemigroups library.
Definition action.hpp:44
Function object for returning the multiplicative identity.
Definition matrix-class.hpp:2078
constexpr bool operator()() const noexcept
Call operator returning the multiplication identity true of the boolean semiring.
Definition matrix-class.hpp:2089
Function object for addition in the boolean semiring.
Definition matrix-class.hpp:2024
constexpr bool operator()(bool x, bool y) const noexcept
Call operator for addition.
Definition matrix-class.hpp:2037
Function object for multiplication in the boolean semiring.
Definition matrix-class.hpp:2051
constexpr bool operator()(bool x, bool y) const noexcept
Call operator for multiplication.
Definition matrix-class.hpp:2064
Function object for returning the additive identity.
Definition matrix-class.hpp:2103
constexpr bool operator()() const noexcept
Call operator returning the additive identity false of the boolean semiring.
Definition matrix-class.hpp:2114
Function object for returning the multiplicative identity.
Definition matrix-class.hpp:2306
constexpr Scalar operator()() const noexcept
Call operator returning the integer 1.
Definition matrix-class.hpp:2316
Function object for addition in the ring of integers.
Definition matrix-class.hpp:2222
constexpr Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for addition.
Definition matrix-class.hpp:2235
Function object for multiplication in the ring of integers.
Definition matrix-class.hpp:2253
constexpr Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for multiplication.
Definition matrix-class.hpp:2266
Function object for returning the additive identity.
Definition matrix-class.hpp:2281
constexpr Scalar operator()() const noexcept
Call operator returning the integer 0.
Definition matrix-class.hpp:2291
Function object for addition in the max-plus semiring.
Definition matrix-class.hpp:2448
Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for addition.
Function object for multiplication in the max-plus semiring.
Definition matrix-class.hpp:2488
Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for multiplication.
Function object for multiplication in truncated max-plus semirings.
Definition matrix-class.hpp:2892
Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for multiplication.
Function object for returning the additive identity of the max-plus semiring.
Definition matrix-class.hpp:2520
constexpr Scalar operator()() const noexcept
Call operator for additive identity.
Definition matrix-class.hpp:2532
Function object for addition in the min-plus semiring.
Definition matrix-class.hpp:2660
Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for addition.
Function object for multiplication in the min-plus semiring.
Definition matrix-class.hpp:2700
Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for multiplication.
Function object for multiplication in min-plus truncated semirings.
Definition matrix-class.hpp:3238
Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for multiplication.
Function object for returning the additive identity of the min-plus semiring.
Definition matrix-class.hpp:2732
constexpr Scalar operator()() const noexcept
Call operator for additive identity.
Definition matrix-class.hpp:2744
Function object for addition in ntp semirings.
Definition matrix-class.hpp:3597
constexpr Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for addition.
Definition matrix-class.hpp:3609
Function object for multiplication in an ntp semirings.
Definition matrix-class.hpp:3638
constexpr Scalar operator()(Scalar x, Scalar y) const noexcept
Call operator for multiplication.
Definition matrix-class.hpp:3652