Polymake Template Library (PTL) 4.13
Generic Matrices
Collaboration diagram for Generic Matrices:

Files

file  GenericMatrix.h
 

Classes

class  pm::GenericMatrix< TMatrix, E >
 Generic type for matrices More...
 
class  pm::Matrix< E >
 Matrix type class which holds the elements in a contiguous array
Additional arithmetic operations for matrices and useful constructions (unit_matrix, diag, ...) are listed at operations. More...
 
class  pm::SparseMatrix< E, symmetric >
 A two-dimensional associative array with row and column indices as keys. More...
 

Functions

template<typename TargetType, typename TMatrix>
const TMatrix & pm::convert_to (const GenericMatrix< TMatrix, TargetType > &m)
 explicit conversion of matrix elements to another type
 
template<typename TVector, typename = std::enable_if_t<is_generic_vector<TVector>::value>>
auto pm::repeat_row (TVector &&v, Int n=0) -> RepeatedRow< diligent_ref_t< unwary_t< TVector > > >
 Create a matrix with n rows, each equal to v.
 
template<typename TVector, typename = std::enable_if_t<is_generic_vector<TVector>::value>>
auto pm::repeat_col (TVector &&v, Int n=0) -> RepeatedCol< diligent_ref_t< unwary_t< TVector > > >
 Create a matrix with n columns, each equal to v.
 
template<typename E>
auto pm::same_element_matrix (E &&x, Int m, Int n)
 
template<typename E>
auto pm::ones_matrix (Int m, Int n)
 
template<typename E>
auto pm::zero_matrix (Int m, Int n)
 
template<typename TVector>
auto pm::vector2row (GenericVector< TVector > &v)
 disguise a GenericVector as a matrix with 1 row
 
template<typename TVector>
auto pm::vector2col (GenericVector< TVector > &v)
 disguise a GenericVector as a matrix with 1 column
 
template<typename TVector>
auto pm::diag (const GenericVector< TVector > &v)
 Create a square diagonal matrix from a GenericVector.
 
template<typename TVector>
auto pm::anti_diag (const GenericVector< TVector > &v)
 Create a anti-diagonal matrix.
 
template<typename E>
auto pm::unit_matrix (Int dim)
 Create a unit_matrix of dimension dim.
 
template<typename E, typename Matrix1, typename Matrix2>
auto pm::diag (const GenericMatrix< Matrix1, E > &m1, const GenericMatrix< Matrix2, E > &m2)
 Create a block-diagonal matrix.
 
template<typename E, typename Vector1, typename Matrix2>
auto pm::diag (const GenericVector< Vector1, E > &v1, const GenericMatrix< Matrix2, E > &m2)
 
template<typename E, typename Matrix1, typename Vector2>
auto pm::diag (const GenericMatrix< Matrix1, E > &m1, const GenericVector< Vector2, E > &v2)
 
template<typename E, typename Matrix1, typename Matrix2>
auto pm::anti_diag (const GenericMatrix< Matrix1, E > &m1, const GenericMatrix< Matrix2, E > &m2)
 Create a block-anti-diagonal matrix.
 
template<typename E, typename Vector1, typename Matrix2>
auto pm::anti_diag (const GenericVector< Vector1, E > &v1, const GenericMatrix< Matrix2, E > &m2)
 
template<typename E, typename Matrix1, typename Vector2>
auto pm::anti_diag (const GenericMatrix< Matrix1, E > &m1, const GenericVector< Vector2, E > &v2)
 

Detailed Description

Function Documentation

◆ anti_diag() [1/2]

template<typename E, typename Matrix1, typename Vector2>
auto pm::anti_diag ( const GenericMatrix< Matrix1, E > & m1,
const GenericVector< Vector2, E > & v2 )

Create a block-anti-diagonal matrix. The vector argument is treated as a square anti-diagonal matrix.

◆ anti_diag() [2/2]

template<typename E, typename Vector1, typename Matrix2>
auto pm::anti_diag ( const GenericVector< Vector1, E > & v1,
const GenericMatrix< Matrix2, E > & m2 )

Create a block-anti-diagonal matrix. The vector argument is treated as a square anti-diagonal matrix.

◆ diag() [1/2]

template<typename E, typename Matrix1, typename Vector2>
auto pm::diag ( const GenericMatrix< Matrix1, E > & m1,
const GenericVector< Vector2, E > & v2 )

Create a block-diagonal matrix. The vector argument is treated as a square diagonal matrix.

◆ diag() [2/2]

template<typename E, typename Vector1, typename Matrix2>
auto pm::diag ( const GenericVector< Vector1, E > & v1,
const GenericMatrix< Matrix2, E > & m2 )

Create a block-diagonal matrix. The vector argument is treated as a square diagonal matrix.

◆ ones_matrix()

template<typename E>
auto pm::ones_matrix ( Int m,
Int n )

Create a matrix with m rows and n columns whose entries are all equal to 1.

◆ same_element_matrix()

template<typename E>
auto pm::same_element_matrix ( E && x,
Int m,
Int n )

Create a matrix with m rows and n columns whose entries are all equal to the given element x.

◆ zero_matrix()

template<typename E>
auto pm::zero_matrix ( Int m,
Int n )

Create a matrix with m rows and n columns whose entries are all equal to 0.