libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
Max-plus matrices

Defined in matrix.hpp.

This page describes the functionality for \(n \times n\) matrices over the max-plus semiring for arbitrary dimension \(n\). There are two types of such matrices those whose dimension is known at compile-time, and those where it is not. Both types can be accessed via the alias template MaxPlusMat if N has value 0, then the dimensions can be set at run time, otherwise N is the dimension. The default value of N is 0.

The alias MaxPlusMat is either StaticMatrix, DynamicMatrix (compile-time arithmetic), or DynamicMatrix (run-time arithmetic), please refer to the documentation of these class templates for more details. The only substantial difference in the interface of static and dynamic matrices is that the former can be default constructed and the latter should be constructed using the dimensions.

Example
// default construct an uninitialized 3 x 3 static matrix
// construct an uninitialized 4 x 4 dynamic matrix
MaxPlusMat<> m(4, 4);
std::conditional_t< R==0||C==0, DynamicMaxPlusMat< Scalar >, StaticMaxPlusMat< R, C, Scalar > > MaxPlusMat
Alias template for max-plus matrices.
Definition matrix.hpp:4586

Classes

struct  MaxPlusPlus< Scalar >
 Function object for addition in the max-plus semiring. More...
 
struct  MaxPlusProd< Scalar >
 Function object for multiplication in the max-plus semiring. More...
 
struct  MaxPlusZero< Scalar >
 Function object for returning the additive identity of the max-plus semiring. More...
 

Typedefs

template<typename Scalar>
using DynamicMaxPlusMat
 Alias for dynamic max-plus matrices.
 
template<size_t R = 0, size_t C = R, typename Scalar = int>
using MaxPlusMat
 Alias template for max-plus matrices.
 
template<size_t R, size_t C, typename Scalar>
using StaticMaxPlusMat
 Alias for static max-plus matrices.
 

Functions

template<typename Mat>
std::enable_if_t< IsMaxPlusMat< Mat > > throw_if_bad_entry (Mat const &, typename Mat::scalar_type val)
 Check that an entry in a max-plus matrix is valid.
 
template<typename Mat>
auto throw_if_bad_entry (Mat const &x) -> std::enable_if_t< IsMaxPlusMat< Mat > >
 Check that a max-plus matrix is valid.
 

Typedef Documentation

◆ DynamicMaxPlusMat

template<typename Scalar>
using DynamicMaxPlusMat
Initial value:
DynamicMatrix<MaxPlusPlus<Scalar>,
Scalar>
Function object for returning the additive identity.
Definition matrix.hpp:4188
Function object for multiplication in the max-plus semiring.
Definition matrix.hpp:4478
Function object for returning the additive identity of the max-plus semiring.
Definition matrix.hpp:4515

Defined in matrix.hpp.

Alias for the type of dynamic max-plus matrices where the dimensions of the matrices can be defined at run time.

Template Parameters
Scalarthe type of the entries in the matrix.

◆ MaxPlusMat

template<size_t R = 0, size_t C = R, typename Scalar = int>
using MaxPlusMat
Initial value:
std::conditional_t<R == 0 || C == 0,
StaticMatrix< MaxPlusPlus< Scalar >, MaxPlusProd< Scalar >, MaxPlusZero< Scalar >, IntegerZero< Scalar >, R, C, Scalar > StaticMaxPlusMat
Alias for static max-plus matrices.
Definition matrix.hpp:4562
DynamicMatrix< MaxPlusPlus< Scalar >, MaxPlusProd< Scalar >, MaxPlusZero< Scalar >, IntegerZero< Scalar >, Scalar > DynamicMaxPlusMat
Alias for dynamic max-plus matrices.
Definition matrix.hpp:4543

Defined in matrix.hpp.

Alias template for max-plus matrices.

Template Parameters
Rthe number of rows. A value of 0 indicates that the value will be set at run time (default: 0).
Cthe number of columns. A value of 0 indicates that the value will be set at run time (default: R).
Scalarthe type of the entries in the matrix (default: int).

◆ StaticMaxPlusMat

template<size_t R, size_t C, typename Scalar>
using StaticMaxPlusMat
Initial value:

Defined in matrix.hpp.

Alias for static max-plus matrices whose arithmetic and dimensions are defined at compile-time.

Template Parameters
Rthe number of rows.
Cthe number of columns.
Scalarthe type of the entries in the matrix.

Function Documentation

◆ throw_if_bad_entry() [1/2]

template<typename Mat>
std::enable_if_t< IsMaxPlusMat< Mat > > throw_if_bad_entry ( Mat const & ,
typename Mat::scalar_type val )

Defined in matrix.hpp.

This function can be used to check that an entry in a matrix belongs to the underlying semiring.

Template Parameters
Matthe type of the matrix, must satisfy IsMaxPlusMat<Mat>.
Parameters
valthe entry to check.
Exceptions
LibsemigroupsExceptionif val is POSITIVE_INFINITY.

◆ throw_if_bad_entry() [2/2]

template<typename Mat>
auto throw_if_bad_entry ( Mat const & x) -> std::enable_if_t<IsMaxPlusMat<Mat>>

Defined in matrix.hpp.

This function can be used to check that a matrix contains values in the underlying semiring.

Template Parameters
Matthe type of the matrix, must satisfy IsMaxPlusMat.
Parameters
xthe matrix to check.
Exceptions
LibsemigroupsExceptionif x contains POSITIVE_INFINITY.