Expand description
§strided-rs
strided-rs is the recommended entry point for the strided-rs workspace. It
re-exports the core strided view, kernel, permutation, and einsum crates so most
users can depend on one package.
§Installation
[dependencies]
strided-rs = "0.1"Use individual crates such as strided-perm, strided-view, or
strided-kernel directly when you want a smaller dependency surface or a
lower-level API.
§Quick Start
use strided_rs::{map_into, StridedArray};
let src = StridedArray::<f64>::from_fn_row_major(&[2, 3], |idx| {
(idx[0] * 10 + idx[1]) as f64
});
let mut dest = StridedArray::<f64>::row_major(&[2, 3]);
map_into(&mut dest.view_mut(), &src.view(), |x| x * 2.0).unwrap();
assert_eq!(dest.get(&[1, 2]), 24.0);§Feature Flags
faer(default): enables thefaerbackend for einsum contractions.parallel: enables Rayon-backed parallel kernels where available.blas: enables the CBLAS backend for einsum contractions.blas-inject: enables BLAS throughcblas-inject.mdarray: re-exports themdarray-opteinsumfrontend asstrided_rs::mdarray.ndarray: re-exports thendarray-opteinsumfrontend asstrided_rs::ndarray.
faer, blas, and blas-inject are mutually exclusive at the einsum backend
level. Disable default features when selecting a BLAS backend. If default
features are disabled, enable one backend feature when using einsum APIs or the
mdarray / ndarray frontends:
[dependencies]
strided-rs = { version = "0.1", default-features = false, features = ["blas"] }§Namespaced APIs
The facade exposes lower-level crates under modules:
strided_rs::traitsstrided_rs::viewstrided_rs::permstrided_rs::kernelstrided_rs::einsum2strided_rs::opteinsum
The individual crates remain public and can be used directly.
Modules§
- einsum2
- Binary einsum contractions on strided views.
- kernel
- Cache-optimized map, reduce, and elementwise kernels.
- opteinsum
- N-ary optimized einsum frontend.
- perm
- Cache-efficient tensor permutation and transpose routines.
- traits
- Shared scalar and element-operation traits.
- view
- Strided view and owned strided array types.
Structs§
- Adjoint
- Adjoint operation: f(x) = adjoint(x) = conj(transpose(x)) For scalar numbers, this is conj.
- Buffer
Pool - Reusable buffer pool for intermediate tensor allocations.
- Conj
- Complex conjugate operation: f(x) = conj(x)
- Einsum
Code - Parsed einsum code: contraction tree + final output indices.
- Identity
- Identity operation: f(x) = x
- Strided
Array - Owned strided multidimensional array.
- Strided
View - Dynamic-rank immutable strided view with lazy element operations.
- Strided
View Mut - Dynamic-rank mutable strided view.
- Transpose
- Transpose operation: f(x) = transpose(x) For scalar numbers, this is identity. For matrix elements, this would transpose each element.
Enums§
- Einsum
Error - Errors that can occur during einsum parsing or evaluation.
- Einsum
Node - Parsed contraction tree node (no operands, just structure).
- Einsum
Operand - A type-erased einsum operand holding either f64 or Complex64 strided data.
- Strided
Data - Type-erased strided data that can be either owned or borrowed.
- Strided
Error - Errors that can occur during strided array operations.
- Typed
Tensor - A type-erased tensor that dispatches over f64 and Complex64 at runtime.
Traits§
- Composable
Element Op - Trait for element operations that support type-level composition.
- Compose
- Helper trait for composing two ElementOp types.
- Einsum
Scalar - Scalar types that can be used as the output element type for
einsum_into. - Element
Op - Trait for element-wise operations applied to strided views.
- Element
OpApply - Trait for types that support element operations (conj, transpose, adjoint).
- Maybe
Simd Ops - Trait for types that may have SIMD-accelerated sum/dot operations.
- Scalar
Base - Shared trait bounds for all element types usable with einsum, independent of GEMM backend.
Functions§
- add
- Element-wise addition:
dest[i] += src[i]. - axpy
- AXPY:
dest[i] = alpha * src[i] + dest[i]. - col_
major_ strides - Compute column-major strides (Julia default: first index varies fastest).
- copy_
conj - Copy with complex conjugation:
dest[i] = conj(src[i]). - copy_
into - Copy elements from source to destination:
dest[i] = src[i]. - copy_
into_ col_ major - Copy elements from
srctodst, optimized for col-major destination. - copy_
scale - Copy with scaling:
dest[i] = scale * src[i]. - copy_
transpose_ scale_ into - Copy with transpose and scaling:
dest[j,i] = scale * src[i,j]. - dot
- Dot product:
sum(OpA::apply(a[i]) * OpB::apply(b[i])). - einsum
- Parse and evaluate an einsum expression in one call.
- einsum_
into - Parse and evaluate an einsum expression, writing the result into a pre-allocated output buffer with alpha/beta scaling.
- einsum_
into_ with_ pool - Parse and evaluate an einsum expression into an output buffer with optional buffer pool reuse.
- einsum_
with_ pool - Parse and evaluate an einsum expression with optional buffer pool reuse.
- fma
- Fused multiply-add:
dest[i] += OpA::apply(a[i]) * OpB::apply(b[i]). - map_
into - Apply a function element-wise from source to destination.
- mul
- Element-wise multiplication:
dest[i] *= src[i]. - reduce
- Full reduction with map function:
reduce(init, op, map.(src)). - reduce_
axis - Reduce along a single axis, returning a new StridedArray.
- row_
major_ strides - Compute row-major strides (C default: last index varies fastest).
- sum
- Sum all elements:
sum(src). - symmetrize_
conj_ into - Conjugate-symmetrize a square matrix:
dest = (src + conj(src^T)) / 2. - symmetrize_
into - Symmetrize a square matrix:
dest = (src + src^T) / 2. - zip_
map2_ into - Binary element-wise operation:
dest[i] = f(a[i], b[i]). - zip_
map3_ into - Ternary element-wise operation:
dest[i] = f(a[i], b[i], c[i]). - zip_
map4_ into - Quaternary element-wise operation:
dest[i] = f(a[i], b[i], c[i], e[i]).