geomc 1.0
A c++ linear algebra template library
|
A matrix with nonzero elements only along the main diagonal. More...
#include <geomc/linalg/mtxtypes/DiagMatrix.h>
Public Types | |
typedef detail::_ImplMtxReftype< DiagMatrix< T, M, N >, T >::reference | reference |
typedef T | elem_t |
Element type. | |
typedef MtxSubsetIterator< const DiagMatrix< T, M, 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 DiagMatrix< T, M, N >, const elem_t > | const_row_iterator |
Read-only iterator over the elments of a row. | |
typedef MtxColIterator< const DiagMatrix< T, M, N >, const elem_t > | const_col_iterator |
Read-only iterator over the elements of a column. | |
typedef Storage< storage_token_t, _ImplStorageObjCount< DiagMatrix< T, M, N > >::count > | storagebuffer_t |
typedef DiagMatrix< T, M, N > | recurring_t |
Public Member Functions | |
DiagMatrix (index_t nrows, index_t ncols) | |
DiagMatrix (const T src[], index_t n) | |
index_t | rows () const |
index_t | cols () const |
T | operator() (index_t r, index_t c) const |
void | set_identity () |
void | set_zero () |
T * | diagonal_begin () |
const T * | diagonal_begin () const |
T * | diagonal_end () |
const T * | diagonal_end () const |
const T & | diagonal (index_t i) const |
T & | diagonal (index_t i) |
void | get_storage_tokens (storage_token_t *buf) const |
constexpr index_t | storage_token_count () const |
derived_const_row_iterator | operator[] (index_t i) const |
const_row_iterator | row (index_t i) const |
const_col_iterator | col (index_t i) const |
const_iterator | begin () const |
const_iterator | end () const |
const_region_iterator | region_begin (const MatrixRegion &r) const |
const_region_iterator | region_end (const MatrixRegion &r) const |
storagebuffer_t | get_storage_token_buffer () const |
Static Public Attributes | |
static constexpr index_t | ROWDIM |
Row dimension template parameter. | |
static constexpr index_t | COLDIM |
Column dimension template parameter. | |
A matrix with nonzero elements only along the main diagonal.
T | Element type. |
M | Row dimension. |
N | Column dimension. |
Storage for DiagMatrix
es is O(n), and operations with diagonal matrices usually benefit from the O(n) algorithmic improvement associated with their lower dimension.
|
inlineexplicit |
Construct a new diagonal matrix.
nrows | Number of rows (ignored / not required if statically sized). |
ncols | Number of columns (ignored / not required if statically sized). |
|
inline |
Construct a new n
x n
diagonal matrix, with diagonal elements copied from src
.
src | Array containing diagonal elements. |
n | Number of elements in src . Ignored / not required if statically sized. |
|
inlineinherited |
|
inlineinherited |
i | Index of column (zero-indexed) |
i
|
inline |
Return a reference to the i
th diagonal element.
|
inline |
Return the i
th diagonal element.
|
inline |
(0, 0)
.
|
inline |
(0, 0)
.
|
inline |
|
inline |
|
inlineinherited |
|
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