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 compiletime, and those
where it is not. Both types can be accessed via the alias template
IntMat<R, C, Scalar>
: 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<R, C, Scalar>
is either StaticMatrix
or
DynamicMatrix
, please refer to the documentation of these class
templates for more details. The only substantial difference in the interface
of StaticMatrix
and DynamicMatrix
is that the former can
be default constructed and the latter should be constructed using the
dimensions.
Example
IntMat<3> m; // default construct an uninitialized 3 x 3 static matrix
IntMat<> m(4, 4); // construct an uninitialized 4 x 4 dynamic matrix

template<typename Scalar>
struct IntegerPlus¶ This is a stateless struct with a single call operator of signature:
Scalar operator()(Scalar const x, Scalar const y) const noexcept
which returns the usual sumx + y
ofx
andy
; representing addition in the integer semiring.

template<typename Scalar>
struct IntegerProd¶ This is a stateless struct with a single call operator of signature:
Scalar operator()(Scalar const x, Scalar const y) const noexcept
which returns the usual productx * y
ofx
andy
; representing multiplication in the integer semiring.

template<typename Scalar>
struct IntegerZero¶ This is a stateless struct with a single call operator of signature:
Scalar operator()() const noexcept
which returns0
; representing the additive identity of the integer semiring.

template<typename Scalar>
struct IntegerOne¶ This is a stateless struct with a single call operator of signature:
Scalar operator()() const noexcept
which returns1
; representing the multiplicative identity of the integer semiring.

template<typename Scalar>
using DynamicIntMat = DynamicMatrix<IntegerPlus<Scalar>, IntegerProd<Scalar>, IntegerZero<Scalar>, IntegerOne<Scalar>, Scalar>¶ Alias for the type of dynamic integer matrices where the dimensions of the matrices can be defined at run time.
 Template Parameters
Scalar – The type of the entries in the matrix (default:
int
).

template<size_t R, size_t C, typename Scalar>
using StaticIntMat = StaticMatrix<IntegerPlus<Scalar>, IntegerProd<Scalar>, IntegerZero<Scalar>, IntegerOne<Scalar>, R, C, Scalar>¶  Template Parameters
R – the number of rows of the matrices. A value of
0
(the default value) indicates that the dimensions will be set at run time.C – the number of columns of the matrices. A value of
0
indicates that the dimensions will be set at run time (the default value isR
).Scalar – The type of the entries in the matrix (default:
int
).

template<size_t R = 0, size_t C = R, Scalar = int>
using IntMat = std::conditional_t<R == 0  C == 0, DynamicIntMat<Scalar>, StaticIntMat<R, C, Scalar>>¶ Alias template for integer matrices.
 Template Parameters
R – the number of rows of the matrices. A value of
0
(the default value) indicates that the dimensions will be set at run time.C – the number of columns of the matrices. A value of
0
indicates that the dimensions will be set at run time (the default value isR
).Scalar – the type of the entries in the matrix (default:
int
).

template<typename T>
static constexpr bool IsIntMat¶ This variable has value
true
if the template parameterT
is the same asIntMat<R, C, Scalar>
for some values ofR
,C
, andScalar
.