strata::TensorInterface¶
Part of Views and expressions.
The shape-derived members of a tensor, written once.
A node derives from TensorInterface<Node> and declares shape(), and shape_type where it can name it. It gets rank, dyn_rank, static_extent, extent, size and empty from it, and may declare its own extent or size where it has a cheaper way; that hides the one here.
Nothing needs it: a type is a tensor_like by what it has, and cursor(tensor) finds the node's cursor or reads by index. As std::ranges::view_interface does for a view, this only adds members.
Template parameters
| Name | Description |
|---|---|
Derived | The node itself. |
Members¶
rank¶
The number of axes.
dyn_rank¶
The number of dynamic axes.
static_extent¶
The extent the type fixes for axis, if any.
extent¶
template <shape_queryable Self>
constexpr std::size_t extent(this const Self &self, std::size_t axis)
The extent of axis, static or dynamic.
size¶
The number of elements: the product of all extents.
empty¶
Whether there are no elements.