libsemigroups  v3.0.0
C++ library for semigroups and monoids
Loading...
Searching...
No Matches
make<Matrix>

This page contains documentation related to safely constructing a Matrix instance.

See also
The `make` function for an overview of possible uses of the this function.

Functions

template<typename Mat, typename Semiring, typename = std::enable_if_t<IsMatrix<Mat>>>
Mat make (Semiring const *semiring, std::initializer_list< std::initializer_list< typename Mat::scalar_type > > const &rows)
 Constructs a matrix (from std::initializer_list) and checks it.
 
template<typename Mat, typename Semiring, typename = std::enable_if_t<IsMatrix<Mat>>>
Mat make (Semiring const *semiring, std::initializer_list< typename Mat::scalar_type > const &row)
 Constructs a row and checks it.
 
template<typename Mat, typename Semiring, typename = std::enable_if_t<IsMatrix<Mat>>>
Mat make (Semiring const *semiring, std::vector< std::vector< typename Mat::scalar_type > > const &rows)
 Constructs a matrix (from std::vector of std::vector) and checks it.
 
template<size_t R, size_t C, typename Scalar>
ProjMaxPlusMat< R, C, Scalar > make (std::initializer_list< std::initializer_list< Scalar > > const &rows)
 Constructs a projective max-plus matrix (from std::initializer_list) and checks it.
 
template<typename Mat, typename = std::enable_if_t<IsMatrix<Mat> && !IsMatWithSemiring<Mat>>>
Mat make (std::initializer_list< std::vector< typename Mat::scalar_type > > const &rows)
 Checks the arguments, constructs a matrix, and checks it.
 
template<typename Mat, typename = std::enable_if_t<IsMatrix<Mat> && !IsMatWithSemiring<Mat>>>
Mat make (std::initializer_list< typename Mat::scalar_type > const &row)
 Constructs a row and checks it.
 
template<typename Mat, typename = std::enable_if_t<IsMatrix<Mat> && !IsMatWithSemiring<Mat>>>
Mat make (std::vector< std::vector< typename Mat::scalar_type > > const &rows)
 Checks the arguments, constructs a matrix, and checks it.
 

Function Documentation

◆ make() [1/7]

template<typename Mat, typename Semiring, typename = std::enable_if_t<IsMatrix<Mat>>>
Mat make ( Semiring const * semiring,
std::initializer_list< std::initializer_list< typename Mat::scalar_type > > const & rows )

Defined in matrix.hpp.

Checks the arguments, constructs a matrix and checks it.

Template Parameters
Matthe type of the matrix being constructed (must satisfy IsMatrix<Mat>).
Semiringthe type of the semiring where arithmetic is performed.
Parameters
semiringa pointer to const semiring object.
rowsthe values to be copied into the matrix.
Returns
The constructed matrix.
Exceptions
LibsemigroupsExceptionif rows does not represent a matrix of the correct dimensions.
LibsemigroupsExceptionif the constructed matrix contains values that do not belong to the underlying semiring.
Complexity
\(O(mn)\) where \(m\) is the number of rows and \(n\) is the number of columns of the matrix.

◆ make() [2/7]

template<typename Mat, typename Semiring, typename = std::enable_if_t<IsMatrix<Mat>>>
Mat make ( Semiring const * semiring,
std::initializer_list< typename Mat::scalar_type > const & row )

Defined in matrix.hpp.

This function constructs a row and checks it.

Template Parameters
Semiringthe type of the semiring where arithmetic is performed.
Parameters
semiringa pointer to const semiring object.
rowthe values to be copied into the row.
Returns
the constructed row if valid.
Exceptions
LibsemigroupsExceptionif the constructed row contains values that do not belong to the underlying semiring.
Complexity
\(O(n)\) where \(n\) is the number of columns of the matrix.

◆ make() [3/7]

template<typename Mat, typename Semiring, typename = std::enable_if_t<IsMatrix<Mat>>>
Mat make ( Semiring const * semiring,
std::vector< std::vector< typename Mat::scalar_type > > const & rows )

Defined in matrix.hpp.

Checks the arguments, constructs a matrix, and checks it.

Template Parameters
Matthe type of the matrix being constructed (must satisfy IsMatrix).
Semiringthe type of the semiring where arithmetic is performed.
Parameters
semiringa pointer to const semiring object.
rowsthe rows to be copied into the matrix.
Returns
The constructed matrix.
Exceptions
LibsemigroupsExceptionif rows does not represent a matrix of the correct dimensions.
LibsemigroupsExceptionif the constructed matrix contains values that do not belong to the underlying semiring.
Complexity
\(O(mn)\) where \(m\) is the number of rows and \(n\) is the number of columns of the matrix.

◆ make() [4/7]

template<size_t R, size_t C, typename Scalar>
ProjMaxPlusMat< R, C, Scalar > make ( std::initializer_list< std::initializer_list< Scalar > > const & rows)

Defined in matrix.hpp.

Checks the arguments, constructs a matrix, and checks it.

Template Parameters
Matthe type of the matrix being constructed (must satisfy IsProjMaxPlusMat<Mat>).
Parameters
rowsthe values to be copied into the matrix.
Returns
The constructed matrix.
Exceptions
LibsemigroupsExceptionif rows does not represent a matrix of the correct dimensions.
LibsemigroupsExceptionif the constructed matrix contains values that do not belong to the underlying semiring.
Complexity
\(O(mn)\) where \(m\) is the number of rows and \(n\) is the number of columns of the matrix.

◆ make() [5/7]

template<typename Mat, typename = std::enable_if_t<IsMatrix<Mat> && !IsMatWithSemiring<Mat>>>
Mat make ( std::initializer_list< std::vector< typename Mat::scalar_type > > const & rows)

Defined in matrix.hpp.

Checks the arguments, constructs a matrix, and checks it.

Template Parameters
Matthe type of matrix being constructed, must satisfy IsMatrix<Mat> and not IsMatWithSemiring<Mat>.
Parameters
rowsthe values to be copied into the matrix.
Returns
The constructed matrix if valid.
Exceptions
LibsemigroupsExceptionif rows does not represent a matrix of the correct dimensions.
LibsemigroupsExceptionif the constructed matrix contains values that do not belong to the underlying semiring.
Complexity
\(O(mn)\) where \(m\) is the number of rows and \(n\) is the number of columns of the matrix.

◆ make() [6/7]

template<typename Mat, typename = std::enable_if_t<IsMatrix<Mat> && !IsMatWithSemiring<Mat>>>
Mat make ( std::initializer_list< typename Mat::scalar_type > const & row)

Defined in matrix.hpp.

This function constructs a row from a std::initializer_list and then calls throw_if_bad_entry.

Template Parameters
Matthe type of matrix being constructed, must satisfy IsMatrix<Mat> and not IsMatWithSemiring<Mat>.
Parameters
rowthe values to be copied into the row.
Returns
the constructed row if valid.
Exceptions
LibsemigroupsExceptionif the constructed row contains values that do not belong to the underlying semiring.
Complexity
\(O(n)\) where \(n\) is the number of columns of the matrix.
Warning
This function only works for rows, i.e. when the template parameter R is 1.

◆ make() [7/7]

template<typename Mat, typename = std::enable_if_t<IsMatrix<Mat> && !IsMatWithSemiring<Mat>>>
Mat make ( std::vector< std::vector< typename Mat::scalar_type > > const & rows)

Defined in matrix.hpp.

Checks the arguments, constructs a matrix, and checks it.

Template Parameters
Matthe type of matrix being constructed, must satisfy IsMatrix<Mat> and not IsMatWithSemiring<Mat>.
Parameters
rowsthe values to be copied into the matrix.
Returns
The constructed matrix if valid.
Exceptions
LibsemigroupsExceptionif rows does not represent a matrix of the correct dimensions.
LibsemigroupsExceptionif the constructed matrix contains values that do not belong to the underlying semiring.
Complexity
\(O(mn)\) where \(m\) is the number of rows and \(n\) is the number of columns of the matrix.