Stratax 0.2.0
Loading...
Searching...
No Matches
Indexing.hpp File Reference

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.

Function Documentation

◆ offset()

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.

Parameters
shapeArray shape.
stridesRow-major or custom strides matching the shape.
indexIndex container with one entry per dimension.
Returns
Flat storage offset.
Exceptions
Exceptions::DimensionErrorIf the ranks do not match.
Exceptions::IndexErrorIf an index is out of bounds or the offset overflows.

Definition at line 23 of file Indexing.hpp.