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

Defined in matrix.hpp.

This page describes the functionality for \(m \times n\) matrices of integers for arbitrary dimensions \(m\) and \(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 IntMat: if R or C has value 0, then the dimensions can be set at run time, otherwise R and C are the dimension. The default value of R is 0, and of C is R.

The alias IntMat 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 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
IntMat<> m(4, 4);
std::conditional_t< R==0||C==0, DynamicIntMat< Scalar >, StaticIntMat< R, C, Scalar > > IntMat
Alias template for integer matrices.
Definition matrix.hpp:4287

Classes

struct  IntegerOne< Scalar >
 Function object for returning the multiplicative identity. More...
 
struct  IntegerPlus< Scalar >
 Function object for addition in the ring of integers. More...
 
struct  IntegerProd< Scalar >
 Function object for multiplication in the ring of integers. More...
 
struct  IntegerZero< Scalar >
 Function object for returning the additive identity. More...
 

Typedefs

template<typename Scalar>
using DynamicIntMat
 Alias for dynamic integer matrices.
 
template<size_t R = 0, size_t C = R, typename Scalar = int>
using IntMat
 Alias template for integer matrices.
 
template<size_t R, size_t C, typename Scalar>
using StaticIntMat
 Alias for static integer matrices.
 

Functions

template<typename Mat>
std::enable_if_t< IsIntMat< Mat > > throw_if_bad_entry (Mat const &, typename Mat::scalar_type val)
 Check that an entry in an integer matrix is valid.
 
template<typename Mat>
std::enable_if_t< IsIntMat< Mat > > throw_if_bad_entry (Mat const &x)
 Check that an integer matrix is valid.
 

Typedef Documentation

◆ DynamicIntMat

template<typename Scalar>
using DynamicIntMat
Initial value:
DynamicMatrix<IntegerPlus<Scalar>,
Scalar>
Function object for returning the multiplicative identity.
Definition matrix.hpp:4213
Function object for multiplication in the ring of integers.
Definition matrix.hpp:4160
Function object for returning the additive identity.
Definition matrix.hpp:4188

Defined in matrix.hpp.

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

Template Parameters
Scalarthe type of the entries in the matrix (default: int).

◆ IntMat

template<size_t R = 0, size_t C = R, typename Scalar = int>
using IntMat
Initial value:
std::conditional_t<R == 0 || C == 0,
DynamicMatrix< IntegerPlus< Scalar >, IntegerProd< Scalar >, IntegerZero< Scalar >, IntegerOne< Scalar >, Scalar > DynamicIntMat
Alias for dynamic integer matrices.
Definition matrix.hpp:4239
StaticMatrix< IntegerPlus< Scalar >, IntegerProd< Scalar >, IntegerZero< Scalar >, IntegerOne< Scalar >, R, C, Scalar > StaticIntMat
Alias for static integer matrices.
Definition matrix.hpp:4262

Defined in matrix.hpp.

Alias template for integer matrices.

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

◆ StaticIntMat

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

Defined in matrix.hpp.

Alias for the type of static integer matrices where the dimensions of the matrices can be defined at compile time.

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

Function Documentation

◆ throw_if_bad_entry() [1/2]

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

Defined in matrix.hpp.

This function throws an exception if the entry val of an integer matrix are not valid, which is if and only if the entry val equals POSITIVE_INFINITY or NEGATIVE_INFINITY.

The 1st argument is used for overload resolution.

Template Parameters
Matthe type of the 1st argument, must satisfy IsMatrix<Mat>.
Parameters
valthe entry to check.

◆ throw_if_bad_entry() [2/2]

template<typename Mat>
std::enable_if_t< IsIntMat< Mat > > throw_if_bad_entry ( Mat const & x)

Defined in matrix.hpp.

This function throws an exception if the entries of an integer matrix are not valid, which is if and only if any of the entries equal POSITIVE_INFINITY or NEGATIVE_INFINITY.

Template Parameters
Matthe type of the argument x, must satisfy IsMatrix<Mat>.
Parameters
xthe matrix to check.