Defines a contiguous storage for two-dimensional numerical data in row-major format.
More...
#include <array2d.h>
|
| Array2D ()=default |
| Initialises new instance of the Array2D class with no storage. More...
|
|
| Array2D (const size_t nrows, const size_t ncols) |
| Initialises new instance of the Array2D class. More...
|
|
| Array2D (const size_t nrows, const size_t ncols, TYPE value) |
| Initialises new instance of the Array2D class with custom default value. More...
|
|
| Array2D (const size_t nrows, const size_t ncols, std::vector< TYPE > &values) |
| Initialises new instance of the Array2D class with custom values. More...
|
|
size_t | size () const noexcept |
| Gets the total size of the array storage. More...
|
|
size_t | rows () const noexcept |
| Gets the number of rows in the array. More...
|
|
size_t | columns () const noexcept |
| Gets the number of coluns in the array. More...
|
|
TYPE & | operator() (size_t row, size_t column) |
| Gets a value from the array. More...
|
|
const TYPE & | operator() (size_t row, size_t column) const |
| Gets a read-only value from the array. More...
|
|
void | fill (TYPE value) |
| Fill the array data with a default value. More...
|
|
void | clear () |
| Clears the array data with the default type value. More...
|
|
std::vector< TYPE > | to_vector () |
| Creates a vector copy of the array data. More...
|
|
std::string | to_string () noexcept |
| Creates a string representation of the array data. More...
|
|
template<Numerical TYPE>
class hgps::core::Array2D< TYPE >
Defines a contiguous storage for two-dimensional numerical data in row-major format.
- Template Parameters
-
TYPE | The numerical type to store |
◆ Array2D() [1/4]
Initialises new instance of the Array2D class with no storage.
◆ Array2D() [2/4]
Initialises new instance of the Array2D class.
- Parameters
-
nrows | The number of rows in the array |
ncols | The number fo columns in the array |
- Exceptions
-
std::invalid_argument | for array with zero size storage; |
◆ Array2D() [3/4]
Initialises new instance of the Array2D class with custom default value.
- Parameters
-
nrows | The number of rows in the array |
ncols | The number of columns in the array |
value | The default value to initialise the array values |
- Exceptions
-
std::invalid_argument | for array with zero size storage; |
◆ Array2D() [4/4]
Initialises new instance of the Array2D class with custom values.
- Parameters
-
nrows | The number of rows in the array |
ncols | The number of columns in the array |
values | Array of values to initialise the storage |
- Exceptions
-
std::invalid_argument | for array size and values size mismatch. |
◆ clear()
Clears the array data with the default type value.
◆ columns()
Gets the number of coluns in the array.
- Returns
- The number of columns
◆ fill()
Fill the array data with a default value.
- Parameters
-
value | The default value to store in the array |
◆ operator()() [1/2]
Gets a value from the array.
- Parameters
-
row | The zero-based row index |
column | The zero-based columns index |
- Returns
- The respective value at location throws std::out_of_range for row or column index out of array bounds
◆ operator()() [2/2]
Gets a read-only value from the array.
- Parameters
-
row | The zero-based row index |
column | The zero-based columns index |
- Returns
- The respective value at location throws std::out_of_range for row or column index out of array bounds
◆ rows()
Gets the number of rows in the array.
- Returns
- The number of rows
◆ size()
Gets the total size of the array storage.
- Returns
- The total size
◆ to_string()
Creates a string representation of the array data.
- Returns
- The string representation
◆ to_vector()
Creates a vector copy of the array data.
- Returns
- The vector with a copy of the data
The documentation for this class was generated from the following file: