|
Stratax
Scientific computing containers and operations
|
#include <cstddef>#include <stratax/core/Exceptions.hpp>#include <stratax/core/Strides.hpp>#include <stratax/core/Shape.hpp>#include <stratax/core/Validation.hpp>Go to the source code of this file.
Functions | |
| template<typename IndexContainer> | |
| std::size_t | offset (const stratax::core::Shape &shape, const stratax::core::Strides &strides, const IndexContainer &index) |
| Computes a flat storage offset from a shape, strides, and index container. | |
| std::size_t offset | ( | const stratax::core::Shape & | shape, |
| const stratax::core::Strides & | strides, | ||
| const IndexContainer & | index ) |
Computes a flat storage offset from a shape, strides, and index container.
| shape | Array shape. |
| strides | Row-major or custom strides matching the shape. |
| index | Index container with one entry per dimension. |
| Exceptions::DimensionError | If the ranks do not match. |
| Exceptions::IndexError | If an index is out of bounds or the offset overflows. |
Definition at line 23 of file Indexing.hpp.
References stratax::core::Shape::begin(), stratax::core::Strides::begin(), stratax::core::validation::checked_add(), stratax::core::validation::checked_multiply(), stratax::core::Shape::rank(), stratax::core::Strides::rank(), and stratax::core::validation::require_rank().
Referenced by stratax::container::Tensor< U >::at(), stratax::container::Tensor< U >::at(), stratax::container::Tensor< U >::operator()(), stratax::container::Tensor< U >::operator()(), and stratax::container::detail::print_tensor_recursive().