|
| 1 | +# MatrixDynamicSize |
| 2 | +Col-major dynamic-size 2d array template implementation. |
| 3 | + |
| 4 | +| Header: | `#include<SimpleMatrix>` | |
| 5 | +| ----: | :---- | |
| 6 | +| Location: | [MatrixDynamicSize.hpp](../../SimpleMatrix/MatrixDynamicSize.hpp) | |
| 7 | + |
| 8 | +<br> |
| 9 | + |
| 10 | +## Defination |
| 11 | +```cpp |
| 12 | +template<class Scalar_t> class OptimT::MatrixDynamicSize; |
| 13 | +``` |
| 14 | +<br> |
| 15 | +
|
| 16 | +## Types |
| 17 | +| Access | Name | Type | Defination | |
| 18 | +| :----: | :----: | ----: | :---- | |
| 19 | +| | [`Scalar_t`](#scalar_t) | template `typename` | | |
| 20 | +| public | [`iterator`](#iterator) | `typedef` | `using iterator = Scalar_t*;` | |
| 21 | +| public | [`citerator`](#citerator) |`typedef` | `using citerator = const Scalar_t*;` | |
| 22 | +
|
| 23 | +<br> |
| 24 | +
|
| 25 | +## Members |
| 26 | +| Access | Type | Name | Default value | |
| 27 | +| :----: | ----: | :---- | :----: | |
| 28 | +| protected | `Scalar_t *` | [`dataPtr`](#dataptr) | `nullptr` | |
| 29 | +| protected | `size_t` | [`rowNum`](#rownum) | 0 | |
| 30 | +| protected | `size_t *` | [`colNum`](#colnum) | 0 | |
| 31 | +
|
| 32 | +<br> |
| 33 | +
|
| 34 | +## Member functions |
| 35 | +| Access | Return type | Defination | |
| 36 | +| :----: | ----: | :---- | |
| 37 | +| public | | [`MatrixDynamicSize()`](#matrixfixedsize) | |
| 38 | +| public | | [`~MatrixDynamicSize()`](#\~matrixfixedsize) | |
| 39 | +| public | `explicit` | [`MatrixDynamicSize(const MatrixDynamicSize &)`](#matrixdynamicsizeconst-matrixdynamicsize--src) | |
| 40 | +| public | `iterator` | [`begin()`](#begin) | |
| 41 | +| public | `iterator` | [`end()`](#end) | |
| 42 | +| public | `size_t` | [`size()`](#size) | |
| 43 | +| public | `size_t` | [`rows()`](#rows) | |
| 44 | +| public | `size_t` | [`cols()`](#cols) | |
| 45 | +| public | `void` | [`resize(size_t r,size_t c)`](#resizesize_t-rsize_t-c) | |
| 46 | +| public | `Scalar_t &` | [`operator()(size_t n)`](#operatorsize_t-n) | |
| 47 | +| public | `Scalar_t &` | [`operator()(size_t r,size_t c)`](#operatorsize_t-rsize_t-c) | |
| 48 | +| public | `Scalar_t *` | [`data()`](#data) | |
| 49 | +| public | `const Scalar_t *` | [`cdata()`](#cdata) | |
| 50 | +| public | `const MatrixDynamicSize &` | [`operator=(const MatrixDynamicSize &)`](#operatorconst-matrixfixedsize--src) | |
| 51 | +
|
| 52 | +<br> |
| 53 | +
|
| 54 | +## Detailed description |
| 55 | +A simple dynamic-size 2d array of any type, without math computation. It is a col-major one. |
| 56 | +
|
| 57 | +<br> |
| 58 | +
|
| 59 | +## Type details |
| 60 | +### `Scalar_t` |
| 61 | +Type of element. |
| 62 | +
|
| 63 | +### `iterator` |
| 64 | +STL-like Iterator. |
| 65 | +
|
| 66 | +### `citerator` |
| 67 | +STL-like constant iterator. |
| 68 | +
|
| 69 | +<br> |
| 70 | +
|
| 71 | +## Member details |
| 72 | +### `dataPtr` |
| 73 | +Data pointer to the first element. |
| 74 | +
|
| 75 | +### `rowNum` |
| 76 | +Number of rows. |
| 77 | +
|
| 78 | +### `colNum` |
| 79 | +Number of coloums. |
| 80 | +
|
| 81 | +<br> |
| 82 | +
|
| 83 | +## Function details |
| 84 | +### `MatrixFixedSize()` |
| 85 | +Default constructor. Matrix size will be set to zero so no memory allocation in this function. |
| 86 | +
|
| 87 | +### `~MatrixFixedSize()` |
| 88 | +Default destructor. Memory will be freed. |
| 89 | +
|
| 90 | +### `MatrixDynamicSize(const MatrixDynamicSize & src)` |
| 91 | +Deep-copy constructor. |
| 92 | +
|
| 93 | +### `begin()` |
| 94 | +STL-like begin function that return an iterator to the first element. |
| 95 | +
|
| 96 | +### `end()` |
| 97 | +STL-like end function that return an iterator after the last element. |
| 98 | +
|
| 99 | +### `size()` |
| 100 | +Count of elements. |
| 101 | +
|
| 102 | +### `rows()` |
| 103 | +Count of rows. |
| 104 | +
|
| 105 | +### `cols()` |
| 106 | +Count of coloumns. |
| 107 | +
|
| 108 | +### `resize(size_t r,size_t c)` |
| 109 | +Resize matrix. If element count is not changed, it beheaves like conservative resize; otherwise every element will be set to undefined value. |
| 110 | +
|
| 111 | +### `operator()(size_t n)` |
| 112 | +Random access to the n-th element. |
| 113 | +
|
| 114 | +### `operator()(size_t r,size_t c)` |
| 115 | +Random access. |
| 116 | +
|
| 117 | +### `data()` |
| 118 | +Writeable data pointer. |
| 119 | +
|
| 120 | +### `cdata()` |
| 121 | +Readonly data pointer. |
| 122 | +
|
| 123 | +### `operator=(const MatrixFixedSize & src)` |
| 124 | +Deep copy function. |
| 125 | +
|
0 commit comments