strata::Shape¶
Part of Shapes and extents.
The extents of a tensor: static ones in the type, dynamic ones at run time.
Shape<3, Dyn, 5> has three axes, the first and the last of fixed extent and the middle one known only at run time. The product of the static extents must stay below the maximum of std::size_t, or the shape does not compile.
Template parameters
| Name | Description |
|---|---|
Extents | One per axis: a number for a static extent, Dyn for a dynamic one. |
Members¶
rank¶
The number of axes.
dyn_rank¶
The number of dynamic axes.
from_extents¶
A shape from every extent, static ones included: from_extents({3, 4, 5}).
Parameters
| Name | Description |
|---|---|
extents | One per axis. Those of static axes must match the type. |
Precondition
The size of the shape does not overflow std::size_t.
static_extent¶
The extent the type fixes for axis, if any.
is_dynamic¶
Whether the extent of axis is dynamic, that is, not fixed by the type.
Shape¶
Dynamic extents start at 0, as in std::extents.
The dynamic extents, in axis order: Shape<3, Dyn, 5, Dyn>{4, 6}.
Parameters
| Name | Description |
|---|---|
extents | One per dynamic axis, of any integer type. |
Precondition
Each extent is non-negative, and the size of the shape does not overflow std::size_t.
Converts from a shape that fixes at least as much: every static extent here is static and equal there.
Shape<3, 4> converts to Shape<Dyn, 4> and Shape<Dyn, Dyn>, never the other way.
extent¶
The extent of axis, static or dynamic.
size¶
The number of elements: the product of all extents.
operator==¶
Two shapes are equal when every extent is.