Skip to content

tenzr::Slice

Per-axis slicing bounds (start, stop, step) used to restrict arrays and layouts.

#include <layout.h>

Public Functions

Name
Slice All()
Select an entire axis.
Slice Index(int64_t idx)
Select a single index along an axis.
Slice Range(int64_t start_idx, int64_t stop_idx, int64_t step_size =1)
Select the stepped range [start_idx, stop_idx) along an axis.

Public Attributes

Name
std::optional< int64_t > start
Start index; nullopt means from the beginning.
std::optional< int64_t > stop
Stop index (exclusive); nullopt means through the end.
int64_t step
Stride between selected elements.

Public Functions Documentation

function All

static inline Slice All()

Select an entire axis.

function Index

static inline Slice Index(
    int64_t idx
)

Select a single index along an axis.

function Range

static inline Slice Range(
    int64_t start_idx,
    int64_t stop_idx,
    int64_t step_size =1
)

Select the stepped range [start_idx, stop_idx) along an axis.

Public Attributes Documentation

variable start

std::optional< int64_t > start {std::nullopt};

Start index; nullopt means from the beginning.

variable stop

std::optional< int64_t > stop {std::nullopt};

Stop index (exclusive); nullopt means through the end.

variable step

int64_t step {1};

Stride between selected elements.