Skip to main content

Crate strided_rs

Crate strided_rs 

Source
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 the faer backend for einsum contractions.
  • parallel: enables Rayon-backed parallel kernels where available.
  • blas: enables the CBLAS backend for einsum contractions.
  • blas-inject: enables BLAS through cblas-inject.
  • mdarray: re-exports the mdarray-opteinsum frontend as strided_rs::mdarray.
  • ndarray: re-exports the ndarray-opteinsum frontend as strided_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::traits
  • strided_rs::view
  • strided_rs::perm
  • strided_rs::kernel
  • strided_rs::einsum2
  • strided_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.
BufferPool
Reusable buffer pool for intermediate tensor allocations.
Conj
Complex conjugate operation: f(x) = conj(x)
EinsumCode
Parsed einsum code: contraction tree + final output indices.
Identity
Identity operation: f(x) = x
StridedArray
Owned strided multidimensional array.
StridedView
Dynamic-rank immutable strided view with lazy element operations.
StridedViewMut
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§

EinsumError
Errors that can occur during einsum parsing or evaluation.
EinsumNode
Parsed contraction tree node (no operands, just structure).
EinsumOperand
A type-erased einsum operand holding either f64 or Complex64 strided data.
StridedData
Type-erased strided data that can be either owned or borrowed.
StridedError
Errors that can occur during strided array operations.
TypedTensor
A type-erased tensor that dispatches over f64 and Complex64 at runtime.

Traits§

ComposableElementOp
Trait for element operations that support type-level composition.
Compose
Helper trait for composing two ElementOp types.
EinsumScalar
Scalar types that can be used as the output element type for einsum_into.
ElementOp
Trait for element-wise operations applied to strided views.
ElementOpApply
Trait for types that support element operations (conj, transpose, adjoint).
MaybeSimdOps
Trait for types that may have SIMD-accelerated sum/dot operations.
ScalarBase
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 src to dst, 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]).