|
Tannic
A C++ Tensor Library
|
Utilities for index normalization and slicing ranges in the Tannic Tensor Library. More...


Go to the source code of this file.
Classes | |
| struct | tannic::indexing::Range |
Represents a half-open interval [start, stop) for slicing. More... | |
Namespaces | |
| namespace | tannic |
| namespace | tannic::indexing |
Typedefs | |
| using | tannic::range = indexing::Range |
Convenience alias for tannic::indexing::Range. | |
Functions | |
| template<Integral Index, Integral Size> | |
| constexpr Index | tannic::indexing::normalize (Index index, Size bound) |
Normalize a possibly-negative index into the valid range [0, bound). | |
| template<Integral Size> | |
| constexpr Range | tannic::indexing::normalize (Range range, Size size) |
Normalize a slicing range into valid [start, stop) indices. | |
Utilities for index normalization and slicing ranges in the Tannic Tensor Library.
This header defines helper structures and functions for working with tensor indices and slices. The utilities are inspired by Python's negative indexing and range semantics, providing a consistent and safe interface for normalizing indices into valid positive ranges within tensor dimensions.