leto
N-dimensional strided array layouts, zero-copy views, and storage backends.
leto is the core crate of the Leto workspace: it owns the
type model that separates layout (shape, strides, offset) from storage
(where the elements live), plus the slicing, transposition, broadcasting, and
structural operations that reshape a view without touching memory. Generic
storage copies also live here; SIMD and threaded kernels live in
leto-ops.
use ;
let layout = c_contiguous?;
let storage = new;
let array = new?;
let view = array.?;
assert_eq!;
# Ok::
What is here
- Const-rank
Layoutwith C- and Fortran-contiguous construction, physical offset calculation, and contiguity queries. - Runtime-rank
LayoutDynfor boundary views, with checked physical spans, exact injectivity validation, and metadata-only broadcasting over shared storage. Array/ArrayView/ArrayViewMutwith rank-readable aliases (Array1..Array3and view variants).- Slicing with signed bounds, negative indices and steps, axis-dropping integer indexing, inserted axes, ellipsis, and implicit trailing axes.
- Zero-copy transposition and broadcasting; broadcast preserves source strides for same-shape axes and uses zero strides only for expanded singleton axes.
transpose_copyclones a dense row-major matrix into caller-owned transposed storage. Checked products and exact lengths reject before mutation; the existing cache-blocked mover also serves assignment and materialization. It creates no intermediate storage, while an element'sClonemay allocate or panic independently.- Storage backends:
VecStorage(owned),SliceStorage/SliceStorageMut(borrowed), andMnemosyneStoragebehind themnemosyne-allocfeature for aligned allocation. - Axis and chunk iteration (
AxisIter,exact_chunks,axis_chunks_iter) and structural ops (concat,pad,split,stack). - Elementwise operators on
Array(&a + &b,&a * scalar,-&a) as the allocating convenience tier.
Documentation
API docs: https://docs.rs/leto
The Leto domain book explains the layout, storage, view, structural, and sparse contracts with executable examples.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.