|
template<std::size_t RANK> |
static bool | CheckIndexValidity (const std::size_t *DimSize, const std::size_t *Index) |
| Checks if all indices in Index are within valid range for a multidimensional array. More...
|
|
template<std::size_t RANK> |
static bool | DecrementIndices (const std::size_t *DimSize, std::size_t *Index) |
| Decrements indices in a multidimensional by one, array using row major indexing. More...
|
|
template<std::size_t RANK> |
static bool | DecrementIndices (const std::size_t *DimSize, std::size_t *Index, std::size_t diff) |
| Decrements indices in a multidimensional array by amount specified in diff, or until an underflow is reached. More...
|
|
template<std::size_t RANK> |
static bool | IncrementIndices (const std::size_t *DimSize, std::size_t *Index) |
| Increment multi-dimensional indices by one in row-major order, accounting for roll-over. More...
|
|
template<std::size_t RANK> |
static bool | IncrementIndices (const std::size_t *DimSize, std::size_t *Index, std::size_t diff) |
| Increment multi-dimensional indices by the amount in diff (accounting for roll-over) and return true if successful, false otherwise. More...
|
|
static std::size_t | Modulus (std::size_t arg, std::size_t n) |
| Calculates the modulus of two integers. More...
|
|
template<std::size_t RANK> |
static std::size_t | OffsetFromRowMajorIndex (const std::size_t *DimSize, const std::size_t *Index) |
| Calculates offset into a multidimensional array using row-major indexing. More...
|
|
template<std::size_t RANK> |
static std::size_t | OffsetFromStrideIndex (const std::size_t *Strides, const std::size_t *Index) |
| Calculates offset for a given index into a multidimensional array using row-major indexing/strides. More...
|
|
template<std::size_t RANK> |
static void | OffsetsForReversedIndices (const std::size_t *DimSize, std::size_t *ReversedIndex) |
| Calculates reversed indices offsets for the given dimensions. More...
|
|
template<std::size_t RANK> |
static void | RowMajorIndexFromOffset (std::size_t offset, const std::size_t *DimSize, std::size_t *Index) |
| Function RowMajorIndexFromOffset. More...
|
|
template<std::size_t RANK> |
static std::size_t | StrideFromRowMajorIndex (std::size_t selected_dim, const std::size_t *DimSize) |
| Calculates stride for a given dimension in a row-major indexed multidimensional array. More...
|
|
template<std::size_t RANK> |
static std::size_t | TotalArraySize (const std::size_t *DimSize) |
| Calculates total size of an array given its dimensions. More...
|
|
utility functions for multidimensional array access
- Date
- Sun Jan 24 14:53:01 2021 -0500
- Author
- J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
template<std::size_t RANK>
static std::size_t hops::MHO_NDArrayMath::OffsetFromStrideIndex |
( |
const std::size_t * |
Strides, |
|
|
const std::size_t * |
Index |
|
) |
| |
|
inlinestatic |
Calculates offset for a given index into a multidimensional array using row-major indexing/strides.
for a multidimensional array (using row major indexing) which has the strides specified in Strides, this function computes the offset from the first element given the indices in the array Index
- Template Parameters
-
RANK | Template parameter RANK |
- Parameters
-
Strides | Array of strides for each dimension |
Index | Indices for each dimension |
- Returns
- Offset from the first element (given the indices)
- Note
- This is a static function.
template<std::size_t RANK>
static std::size_t hops::MHO_NDArrayMath::StrideFromRowMajorIndex |
( |
std::size_t |
selected_dim, |
|
|
const std::size_t * |
DimSize |
|
) |
| |
|
inlinestatic |
Calculates stride for a given dimension in a row-major indexed multidimensional array.
for a multidimensional array (using row major indexing) which has the dimensions specified in DimSize, this function computes the stride between consecutive elements in the selected dimension given that the other indices are fixed the first element given the indices in the array Index
- Template Parameters
-
RANK | Template parameter RANK |
- Parameters
-
selected_dim | Selected dimension index |
DimSize | Array containing dimensions sizes |
- Returns
- Stride value as std::size_t
- Note
- This is a static function.