|
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 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 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 T & | reference |
| Reference to 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 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 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 iterator | region_iterator |
| Writeable row-major region iterator.
|
|
typedef T | elem_t |
| Element type.
|
|
typedef const_iterator | const_region_iterator |
| Read-only row-major iterator over the matrix elements in a rectangular region.
|
|
typedef Storage< storage_token_t, _ImplStorageObjCount< Derived >::count > | storagebuffer_t |
|
typedef Derived | recurring_t |
|
|
| SimpleMatrix (index_t nrows, index_t ncols) |
| Construct a matrix of size (nrows x ncols) . More...
|
|
| SimpleMatrix (T *src_data, index_t nrows, index_t ncols) |
| Construct a matrix of size (nrows x ncols) , initialized with src_data . More...
|
|
template<typename Mx > |
| SimpleMatrix (const Mx &mtx) |
|
template<typename U > |
SimpleMatrix< T, M, N > & | operator*= (U k) |
|
index_t | rows () const |
|
index_t | cols () const |
|
const_row_iterator | row (index_t i) const |
|
row_iterator | row (index_t i) |
|
const_col_iterator | col (index_t i) const |
|
col_iterator | col (index_t i) |
|
const_iterator | begin () const |
|
const_iterator | end () const |
|
iterator | begin () |
|
iterator | end () |
|
T * | data_begin () |
|
T * | data_end () |
|
const T * | data_begin () const |
|
const T * | data_end () const |
|
T | operator() (index_t r, index_t c) const |
|
reference | operator() (index_t r, index_t c) |
|
reference | set (index_t r, index_t c, T val) |
|
WrapperMatrix< T, N, M,(Lyt==ROW_MAJOR) ? COL_MAJOR :ROW_MAJOR > | as_transpose () const |
|
void | set_identity () |
|
void | set_zero () |
|
void | get_storage_tokens (storage_token_t *buf) const |
|
constexpr index_t | storage_token_count () const |
|
derived_row_iterator | operator[] (index_t i) |
|
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 |
|
region_iterator | region_end (const MatrixRegion &r) |
|
const_region_iterator | region_end (const MatrixRegion &r) const |
|
storagebuffer_t | get_storage_token_buffer () 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.