DynamicMatrix (with compile time arithmetic)

Defined in matrix.hpp.

template<
typename PlusOp,
typename ProdOp,
typename ZeroOp,
typename OneOp,
typename Scalar
>
class DynamicMatrix final

This is a class for matrices where the arithmetic operations in the underlying semiring are known at compile time, and the dimensions of the matrix can be set at run time.

Template Parameters
  • PlusOp – a stateless type with a call operator of signature scalar_type operator()(scalar_type, scalar_type) implementing the addition of the semiring

  • ProdOp – a stateless type with a call operator of signature scalar_type operator()(scalar_type, scalar_type) implementing the multiplication of the semiring

  • ZeroOp – a stateless type with a call operator of signature scalar_type operator()() returning the zero of the semiring (the additive identity element)

  • OneOp – a stateless type with a call operator of signature scalar_type operator()() returning the one of the semiring (the multiplicative identity element)

  • Scalar – the type of the entries in the matrices (the type of elements in the underlying semiring)

Note

Certain member functions only work for square matrices and some only work for rows.

Member types

Member type

Definition

scalar_type

the type of scalars contained in the matrix (Scalar)

scalar_reference

the type of references to scalars contained in the matrix

scalar_const_reference

the type of const references to scalars contained in the matrix

Row

type of a row of the matrix

RowView

type of a row view int the matrix

Plus

the template parameter PlusOp

Prod

the template parameter ProdOp

Zero

the template parameter ZeroOp

One

the template parameter OneOp

semiring_type

void

Member functions

(constructor)

constructs the matrix

number_of_rows/number_of_cols

the number of rows/columns in the matrix

Static member functions

make

constructs a matrix and checks that its entries are valid

identity

constructs an identity matrix

Iterators

begin/cbegin

returns an iterator to the beginning

end/cend

returns an iterator to the end

coords

returns the coordinates corresponding to an iterator

Accessors

operator()

access specified element

row

access specified row

rows

add all rows to a container

Arithmetic operators

operator+=

add a (matrix, scalar, or row view) to the matrix in place

operator*=

multiply the matrix by a matrix or scalar in place

operator+

add a (matrix, scalar, or row view) to the matrix

operator*

multiply the matrix by a matrix or scalar

Comparison operators

operator==

compare matrices

operator!=

compare matrices

operator<

compare matrices

operator>

compare matrices

Modifiers

swap

swaps the contents

transpose

transposes the matrix