Skip to content

strata::Block

Part of Views and expressions.

template <tensor_like E, Extent... Sizes>
class strata::Block;

E cut to a box: a corner and a size on each axis.

Element i... of the block is the operand's at i + corner.

What block(e, seqs...) gives for a node that has no block of its own: it reads through the operand, and its cursor is the operand's, moved to the corner once. A node with a better way, a view whose block is another view, gives that instead.

Template parameters

Name Description
E The operand as it is held, capture_t of what was given: borrowed for an lvalue owner, owned for a temporary one, which makes the block moved and never copied, else by value.
Sizes The extent of the block on each axis: a number, or Dyn where it is known at run time.

Members

corner_type

using strata::Block< E, Sizes >::corner_type = std::array<std::size_t, rank_>

The position of the block's first element in the operand, one index per axis.

Block

constexpr Block(E operand, const shape_type &sizes, const corner_type &corner)

operand cut to a box of shape sizes at corner.

Precondition

On each axis the corner is inside the operand, and the size fits in what remains.

operand

constexpr const E & operand() const noexcept STRATA_LIFETIMEBOUND

The operand that is cut.

corner

constexpr const corner_type & corner() const noexcept STRATA_LIFETIMEBOUND

Where the block starts in the operand.

shape

constexpr const shape_type & shape() const noexcept STRATA_LIFETIMEBOUND

The shape of the block.

cursor

constexpr auto cursor() const

Where a traversal starts: the operand's cursor, moved to the corner.

operator[]

template <index_like... Indices>
constexpr value_type operator[](Indices... indices) const

The element at a position of the block: the operand's, moved by the corner.

Precondition

Each index is within the extent of its axis of the block.

block

template <Extent... Outer>
constexpr auto block(const Block &blocked, const Shape<Outer...> &sizes, const std::array<std::size_t, sizeof...(Outer)> &corner)

The block of the block: one block of the operand, of the inner box's own corner moved by the outer's.