Polymake Template Library (PTL) 4.12
Public Member Functions | List of all members
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...

#include <Matrix.h>

Inheritance diagram for pm::Matrix< E >:
Inheritance graph
[legend]
Collaboration diagram for pm::Matrix< E >:
Collaboration graph
[legend]

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 = std::enable_if_t<mlist_and_nonempty<fits_as_input_iterator<Iterator>...>::value>>
 Matrix (Int r, Int c, Iterator &&... src)
 
template<typename... Iterator, typename = std::enable_if_t<mlist_and_nonempty<fits_as_input_iterator<Iterator>...>::value>>
 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, std::enable_if_t< can_initialize< E2, E >::value, void ** >=nullptr)
 Copy of an abstract matrix with element conversion.
 
void swap (Matrix &m)
 Exchange the contents of two matrices in a most efficient way.
 
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)
 
top_type & negate ()
 negate elements in place
 
std::enable_if< is_expandable_by< TMatrix2 >(), top_type & >::type operator/= (const GenericMatrix< TMatrix2 > &m)
 append rows of another matrix
 
std::enable_if< is_expandable_by< TVector >(), top_type & >::type operator/= (const GenericVector< TVector > &v)
 append a vector as a row
 
std::enable_if_t< is_expandable_by< TMatrix2 >(), top_type & > operator|= (const GenericMatrix< TMatrix2 > &m)
 append columns of another matrix
 
std::enable_if_t< is_expandable_by< TVector >(), top_type & > operator|= (const GenericVector< TVector > &v)
 append a vector as a column
 
IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > diagonal (Int i=0) const &
 
IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > anti_diagonal (Int i=0) const &
 

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

◆ Matrix()

template<typename E >
template<typename... Iterator, typename = std::enable_if_t<mlist_and_nonempty<fits_as_input_iterator<Iterator>...>::value>>
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

◆ anti_diagonal()

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< Matrix< E > , E >::anti_diagonal ( Int i = 0) const &
inlineinherited
Parameters
i==0main anti-diagonal; i>0: i-th diagonal below the main; i<0: (-i)-th above the main

◆ diagonal()

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< Matrix< E > , E >::diagonal ( Int i = 0) const &
inlineinherited
Parameters
i==0main diagonal; i>0: i-th diagonal below the main; i<0: (-i)-th above the main

◆ fill()

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.

◆ swap()

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: