|
geomc 1.0
A c++ linear algebra template library
|
A matrix which, by multiplication, permutes the rows or columns of another matrix. More...
#include <geomc/linalg/mtxtypes/PermutationMatrix.h>
Public Types | |
| typedef MtxColIterator< const PermutationMatrix< N >, const elem_t > | const_col_iterator |
| Read-only iterator over the elements of a column. | |
| typedef MtxSubsetIterator< const PermutationMatrix< N >, const elem_t > | const_iterator |
| Read-only row-major iterator over matrix elements. | |
| typedef const_iterator | const_region_iterator |
| Read-only row-major iterator over the matrix elements in a rectangular region. | |
| typedef MtxRowIterator< const PermutationMatrix< N >, const elem_t > | const_row_iterator |
| Read-only iterator over the elments of a row. | |
| typedef bool | elem_t |
| Element type. | |
| typedef PermutationMatrix< N > | recurring_t |
| typedef Storage< storage_token_t, _ImplStorageObjCount< PermutationMatrix< N > >::count > | storagebuffer_t |
Public Member Functions | |
| PermutationMatrix () | |
| PermutationMatrix (index_t n) | |
| const_iterator | begin () const |
| const_col_iterator | col (index_t i) const |
| index_t | cols () const |
| const_iterator | end () const |
| storagebuffer_t | get_storage_token_buffer () const |
| void | get_storage_tokens (storage_token_t *buf) const |
| const index_t * | getColDestinations () const |
| const index_t * | getColSources () const |
| const index_t * | getRowDestinations () const |
| const index_t * | getRowSources () const |
| bool | operator() (index_t row, index_t col) const |
| derived_const_row_iterator | operator[] (index_t i) const |
| const_region_iterator | region_begin (const MatrixRegion &r) const |
| const_region_iterator | region_end (const MatrixRegion &r) const |
| const_row_iterator | row (index_t i) const |
| index_t | rows () const |
| void | set_identity () |
| void | setColDestinations (const index_t *p) |
| void | setColSources (const index_t *p) |
| void | setRowDestinations (const index_t *p) |
| void | setRowSources (const index_t *p) |
| index_t | sign () |
| constexpr index_t | storage_token_count () const |
| void | swap_cols (index_t a, index_t b) |
| void | swap_rows (index_t a, index_t b) |
| void | transpose () |
Static Public Attributes | |
| static constexpr index_t | COLDIM |
| Column dimension template parameter. | |
| static constexpr index_t | ROWDIM |
| Row dimension template parameter. | |
Friends | |
| template<typename Md, typename Ma, typename Mb> | |
| class | detail::_ImplMtxMul |
| bool | detail::mtxequal (const PermutationMatrix< N > &a, const PermutationMatrix< N > &b) |
A matrix which, by multiplication, permutes the rows or columns of another matrix.
A permutation matrix P permutes rows if left-multiplied (P * M), and permutes columns if right-multiplied (M * P).
Permutation matrices are always (n x n) and have only elements that are zero or 1. Each row and column has exactly one 1 element.
An (n x n) permutation matrix uses O(n) storage, and multiplications by other matrices are optimized to perform the permutation directly in _O(n2)_ (rather than _O(n3)_) time. Multiplication of two permutation matrices is O(n).
|
inline |
Construct a new identity permutation matrix.
|
inlineexplicit |
Construct a new identity permutation matrix of size n. (Dynamic only).
|
inlineinherited |
|
inlineinherited |
| i | Index of column (zero-indexed) |
i
|
inline |
|
inlineinherited |
|
inline |
Array containing a mapping of source columns to destination columns in a column-permuting operation.
In other words, given the column-permuting multiplication:
M * P = D
return an array a such that column Da[i]= Mi.
Because of the property that a permutation matrix's inverse is its transpose, this function is equivalent to getRowSources().
|
inline |
Array containing a mapping of destination columns to source columns in a column-permuting operation.
In other words, given the column-permuting multiplicaton:
M * P = D
return an array a such that column Di= Ma[i].
|
inline |
Array containing a mapping of source rows to destination rows in a row-permuting operation.
In other words, given the row-permuting multiplication:
P * M = D
return an array a such that row Da[i]= Mi.
Because of the property that a permutation matrix's inverse is its transpose, this function is equivalent to getColSources().
|
inline |
Array containing a mapping of destination rows to source rows in a row-permuting operation.
In other words, given the row-permuting multiplicaton:
P * M = D
return an array a such that row Di= Ma[i].
|
inline |
Get the element at (row, col).
| row | Zero-indexed row coordinate |
| col | Zero-indexed column coordinate |
(row, col); either 0 or 1.
|
inlineinherited |
| i | Index of row (zero-indexed) |
i
|
inlineinherited |
| r | The zero-indexed region to iterate over. The upper extreme coordinates represent the index just beyond the last element to be iterated over. |
r, pointing at the first element in the region (upper left corner).
|
inlineinherited |
| r | The zero-indexed region to iterate over. The upper extreme coordinates represent the index just beyond the last element to be iterated over. |
r, pointing at the element just beyond the last element in the region.
|
inlineinherited |
| i | Index of row (zero-indexed) |
i
|
inline |
|
inline |
Reset this matrix to the identity permutation.
|
inline |
Set the permutation described by this matrix by passing an array mapping source columns to destination columns in a column-permuting operation.
In other words, define the column-permuting multiplication:
M * P = D
with an array a such that column Da[i]= Mi.
Because of the property that a permutation matrix's inverse is its transpose, this function is equivalent to setRowSources().
| p | Array of indecies. |
|
inline |
Set the permutation described by this matrix by passing a mapping of destination columns to source columns in a column-permuting operation.
In other words, define the column-permuting multiplicaton:
M * P = D
with an array a such that column Di= Ma[i].
| p | Array of indecies. |
|
inline |
Set the permutation described by this matrix by passing an array mapping source rows to destination rows in a row-permuting operation.
In other words, define the row-permuting multiplication:
P * M = D
with an array a such that row Da[i]= Mi.
Because of the property that a permutation matrix's inverse is its transpose, this function is equivalent to setColSources().
| p | Array of indecies. |
|
inline |
Set the permutation described by this matrix by passing a mapping of destination rows to source rows in a row-permuting operation.
In other words, define the row-permuting multiplicaton:
P * M = D
with an array a such that row Di= Ma[i].
| p | Array of indecies. |
|
inline |
Compute the signature of this permutation.
Runs in O(n) time; or O(1) time if previously computed.
|
inline |
Adjust this matrix such that columns a and b are swapped in the destination matrix after applying a column permutation. This operation is cumulative on any previous swaps.
| a | A column index. |
| b | A column index. |
|
inline |
Adjust this matrix such that rows a and b are swapped in the destination matrix after applying a row permutation. This operation is cumulative on any previous swaps.
| a | A row index. |
| b | A row index. |
|
inline |
Transpose this matrix in-place in O(1) time. For this type of matrix, also the inverse matrix.