|
|
typedef FlatMatrixLayout< T, Lyt >::col_iterator | col_iterator |
| | Writeable iterator over the elements of a column. This is a T* if the matrix is column-major; a proxy otherwise.
|
| |
|
typedef FlatMatrixLayout< T, Lyt >::const_col_iterator | const_col_iterator |
| | Read-only iterator over the elements of a column. This is a T* if the matrix is column-major; a proxy otherwise.
|
| |
|
typedef FlatMatrixLayout< T, Lyt >::const_row_iterator | const_iterator |
| | Read-only row-major iterator over the elements of the matrix. This is a T* if the matrix is row-major; a proxy otherwise.
|
| |
|
typedef const_iterator | const_region_iterator |
| | Read-only row-major iterator over the matrix elements in a rectangular region.
|
| |
|
typedef FlatMatrixLayout< T, Lyt >::const_row_iterator | const_row_iterator |
| | Read-only iterator over the elements of a row. This is a T* if the matrix is row-major; a proxy otherwise.
|
| |
|
typedef T | elem_t |
| | Element type.
|
| |
|
typedef FlatMatrixLayout< T, Lyt >::row_iterator | iterator |
| | Writeable row-major iterator over the elements of the matrix. This is a T* if the matrix is row-major; a proxy otherwise.
|
| |
|
typedef SimpleMatrix< T, M, N, Lyt, P > | recurring_t |
| |
|
typedef T & | reference |
| | Reference to element type.
|
| |
|
typedef iterator | region_iterator |
| | Writeable row-major region iterator.
|
| |
|
typedef FlatMatrixLayout< T, Lyt >::row_iterator | row_iterator |
| | Writeable iterator over the elements of a row. This is a T* if the matrix is row-major; a proxy otherwise.
|
| |
|
typedef Storage< storage_token_t, _ImplStorageObjCount< SimpleMatrix< T, M, N, Lyt, P > >::count > | storagebuffer_t |
| |
|
| template<typename Mx> |
| | SimpleMatrix (const Mx &mtx) |
| |
| | SimpleMatrix (index_t nrows, index_t ncols) |
| | Construct a matrix of size (nrows x ncols).
|
| |
| | SimpleMatrix (T *src_data, index_t nrows, index_t ncols) |
| | Construct a matrix of size (nrows x ncols), initialized with src_data.
|
| |
| WrapperMatrix< T, N, M,(Lyt==ROW_MAJOR) ? COL_MAJOR :ROW_MAJOR > | as_transpose () const |
| |
| iterator | begin () |
| |
| const_iterator | begin () const |
| |
| col_iterator | col (index_t i) |
| |
| const_col_iterator | col (index_t i) const |
| |
| index_t | cols () const |
| |
| T * | data_begin () |
| |
| const T * | data_begin () const |
| |
| T * | data_end () |
| |
| const T * | data_end () const |
| |
| iterator | end () |
| |
| const_iterator | end () const |
| |
|
storagebuffer_t | get_storage_token_buffer () const |
| |
|
void | get_storage_tokens (storage_token_t *buf) const |
| |
| reference | operator() (index_t r, index_t c) |
| |
| T | operator() (index_t r, index_t c) const |
| |
| template<typename U> |
| SimpleMatrix< T, M, N > & | operator*= (U k) |
| |
| derived_row_iterator | operator[] (index_t i) |
| |
| derived_const_row_iterator | operator[] (index_t i) const |
| |
| derived_const_row_iterator | operator[] (index_t i) const |
| |
| region_iterator | region_begin (const MatrixRegion &r) |
| |
| const_region_iterator | region_begin (const MatrixRegion &r) const |
| |
| const_region_iterator | region_begin (const MatrixRegion &r) const |
| |
| region_iterator | region_end (const MatrixRegion &r) |
| |
| const_region_iterator | region_end (const MatrixRegion &r) const |
| |
| const_region_iterator | region_end (const MatrixRegion &r) const |
| |
| row_iterator | row (index_t i) |
| |
| const_row_iterator | row (index_t i) const |
| |
| index_t | rows () const |
| |
| reference | set (index_t r, index_t c, T val) |
| |
| void | set_identity () |
| |
| void | set_zero () |
| |
|
constexpr index_t | storage_token_count () const |
| |
template<typename T, index_t M, index_t N, MatrixLayout Lyt,
StoragePolicy P>
class geom::SimpleMatrix< T, M, N, Lyt, P >
A basic matrix with M x N elements.
- Template Parameters
-
| T | Element type. |
| M | Row dimension. |
| N | Column dimension. |
| Lyt | Layout of the underlying array (ROW_MAJOR or COL_MAJOR). ROW_MAJOR is the default. |
| P | Policy for memory ownership of the backing array. |
Example:
SimpleMatrix<double,4,4> mx;
If M or N are 0, the matrix has runtime-chosen size.
The storage policy behavior is as follows:
-
If the StoragePolicy is
STORAGE_UNIQUE (default), then copy-constructed duplicates of dynamically-sized matrices will make a full copy of the underlying array.
-
If the StoragePolicy is
STORAGE_SHARED, then all copy-constructed duplicates of dynamically-sized matrixes should be treated as references to a common array.
-
If the StoragePolicy is
STORAGE_WRAPPED, then the matrix will wrap a user-provided backing array, whose lifetime is managed manually.
Note that in c++11, array duplicatations will use rvalue references to avoid a performing full array-copy where possible.
Wrapping an array
A SimpleMatrix can be made into a wrapper around a user-owned array like so:
double myRowMajorArray[16] = { ... };
SimpleMatrix<double,4,4,STORAGE_WRAPPED> mtx(myRowMajorArray);
In the above example, no array duplication will occur, and myRowMajorArray is used direcly as the backing storage for the matrix. Note the use of STORAGE_WRAPPED for the SimpleMatrix's storage policy template parameter.
In c++11, a template alias is available for this construction, called WrapperMatrix:
WrapperMatrix<double,4,4> wmtx(myRowMajorArray);
For more on matrices, see the matrix module documentation.