Polymake Template Library (PTL) 4.13
polymake::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 polymake::Matrix< E >:
Collaboration diagram for polymake::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 = 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 resize (Int r, Int c)
 Resize to new dimensions, added elements initialized with default constructor.
 
top_type & operator= (const GenericMatrix &m)
 
void swap (Matrix &m)
 Exchange the contents of two matrices in a most efficient way.
 
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)
 
void fill (const E2 &x)
 
void fill (const E2 &x)
 
top_type & negate ()
 negate elements in place
 
top_type & negate ()
 negate elements in place
 
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< 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< 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
 
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
 
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 > diagonal (Int i=0) const &
 
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 &
 
IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > anti_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 polymake::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() [1/3]

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< TMatrix, 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

◆ anti_diagonal() [2/3]

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< TMatrix, 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

◆ anti_diagonal() [3/3]

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< TMatrix, 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() [1/3]

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< TMatrix, 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

◆ diagonal() [2/3]

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< TMatrix, 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

◆ diagonal() [3/3]

IndexedSlice< masquerade< ConcatRows, const typename Unwary< Matrix< E > >::type & >, const series > pm::GenericMatrix< TMatrix, 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() [1/3]

void pm::GenericMatrix< TMatrix, 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.

◆ fill() [2/3]

void pm::GenericMatrix< TMatrix, 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.

◆ fill() [3/3]

void pm::GenericMatrix< TMatrix, 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.

◆ operator=()

template<typename E>
top_type & pm::GenericMatrix< TMatrix, E >::operator= ( const GenericMatrix< E > & m)
inline

Persistent matrix objects have after the assignment the same dimensions as the right hand side operand. Alias objects, such as matrix minor or block matrix, cannot be resized, thus must have the same dimensions as on the right hand side.

◆ swap()

void pm::GenericMatrix< TMatrix, 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: