Polymake Template Library (PTL): pm::Matrix< E > Class Template Reference
pm::Matrix< E > Class Template Reference

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...

Inheritance diagram for pm::Matrix< E >:
Collaboration diagram for pm::Matrix< E >:

Public Member Functions

 Matrix ()
 create as empty
 
 Matrix (int r, int c)
 create matrix with r rows and c columns, initialize all elements to 0
 
template<typename... Iterator, typename = typename std::enable_if<mlist_and_nonempty<fits_as_input_iterator<Iterator>...>::value>::type>
 Matrix (int r, int c, Iterator &&...src)
 
template<typename... Iterator, typename = typename std::enable_if<mlist_and_nonempty<fits_as_input_iterator<Iterator>...>::value>::type>
 Matrix (int r, int c, polymake::operations::move, Iterator &&...src)
 Create a matrix with given dimensions. Elements are moved from one or more input sequences.
 
 Matrix (const GenericMatrix< Matrix > &m)
 Copy of a disguised Matrix object.
 
template<typename Matrix2 >
 Matrix (const GenericMatrix< Matrix2, E > &m)
 Copy of an abstract matrix of the same element type.
 
template<typename Matrix2 , typename E2 >
 Matrix (const GenericMatrix< Matrix2, E2 > &m, typename std::enable_if< can_initialize< E2, E >::value, void ** >::type=nullptr)
 Copy of an abstract matrix with element conversion.
 
void swap (Matrix &m)
 
void resize (int r, int c)
 Resize to new dimensions, added elements initialized with default constructor.
 
void clear ()
 Truncate to 0x0 matrix.
 
int rows () const
 the number of rows of the matrix
 
int cols () const
 the number of columns of the matrix
 
void swap (GenericMatrix< TMatrix2, E > &m)
 
void fill (const E2 &x)
 
std::enable_if< compatible_symmetry_types< TMatrix2 >), top_type & >::type operator+= (const GenericMatrix< TMatrix2 > &m)
 adding a GenericMatrix
 
std::enable_if< compatible_symmetry_types< TMatrix2 >), top_type & >::type operator-= (const GenericMatrix< TMatrix2, E > &m)
 subtracting a GenericMatrix
 
top_type & operator*= (const Right &r)
 multiply with an element
 
std::enable_if< is_expandable_by< TMatrix2 >), top_type & >::type operator/= (const GenericMatrix< TMatrix2 > &m)
 append the rows of a GenericMatrix
 
std::enable_if< is_expandable_by< TVector >), top_type & >::type operator/= (const GenericVector< TVector > &v)
 append a GenericVector as a row
 
std::enable_if< isomorphic_types< E, Right >::value, top_type & >::type div_exact (const Right &r)
 divide by an element
 
std::enable_if< is_expandable_by< TMatrix2 >), top_type & >::type operator|= (const GenericMatrix< TMatrix2 > &m)
 append the columns of a GenericMatrix
 
std::enable_if< is_expandable_by< TVector >), top_type & >::type operator|= (const GenericVector< TVector > &v)
 append a GenericVector as a column
 
IndexedSlice< ConcatRows< unwary_t< Matrix< E > > > &, series > diagonal (int i=0)
 
IndexedSlice< ConcatRows< unwary_t< Matrix< E > > > &, series > anti_diagonal (int i=0)
 

Detailed Description

template<typename E>
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.

Constructor & Destructor Documentation

template<typename E >
template<typename... Iterator, typename = typename std::enable_if<mlist_and_nonempty<fits_as_input_iterator<Iterator>...>::value>::type>
pm::Matrix< E >::Matrix ( int  r,
int  c,
Iterator &&...  src 
)
inline

Create a matrix with given dimensions. Elements are initialized from one or more input sequences. Elements are assumed to come in the row order.

Member Function Documentation

IndexedSlice<ConcatRows<unwary_t<Matrix< E > > >&, series> pm::GenericMatrix< Matrix< E > , E >::anti_diagonal ( int  i = 0)
inlineinherited
Parameters
i==0main anti-diagonal; i>0: i-th diagonal below the main; i<0: (-i)-th above the main
IndexedSlice<ConcatRows<unwary_t<Matrix< E > > >&, series> pm::GenericMatrix< Matrix< E > , E >::diagonal ( int  i = 0)
inlineinherited
Parameters
i==0main diagonal; i>0: i-th diagonal below the main; i<0: (-i)-th above the main
void pm::GenericMatrix< Matrix< E > , E >::fill ( const E2 &  x)
inlineinherited

Fill with given value without changing the dimensions. x can be of arbitrary type assignable to the type E2.

template<typename E >
void pm::Matrix< E >::swap ( Matrix< E > &  m)
inline

Exchange the contents of two matrices in a most efficient way. If at least one non-persistent object is involved, the operands must have equal dimensions.

void pm::GenericMatrix< Matrix< E > , E >::swap ( GenericMatrix< TMatrix2, E > &  m)
inlineinherited

Exchange the contents of two matrices in a most efficient way. If at least one non-persistent object is involved, the operands must have equal dimensions.


The documentation for this class was generated from the following files: