Skip to main content

Crate strided_opteinsum

Crate strided_opteinsum 

Source
Expand description

N-ary Einstein summation with nested contraction notation.

This crate provides an einsum frontend that parses nested string notation (e.g. "(ij,jk),kl->il"), supports mixed f64 / Complex64 operands, and delegates pairwise contractions to strided_einsum2. For three or more tensors in a single contraction node the [omeco] greedy optimizer is used to find an efficient pairwise order.

§Quick start

use strided_opteinsum::{einsum, EinsumOperand};

let result = einsum("(ij,jk),kl->il", vec![a.into(), b.into(), c.into()], None)?;

Structs§

BufferPool
Reusable buffer pool for intermediate tensor allocations.
EinsumCode
Parsed einsum code: contraction tree + final output indices.

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.
TypedTensor
A type-erased tensor that dispatches over f64 and Complex64 at runtime.

Traits§

EinsumScalar
Scalar types that can be used as the output element type for einsum_into.

Functions§

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.
needs_c64_promotion
Returns true if any input is Complex64 (triggering promotion for all).
parse_einsum
Parse an einsum string like “(ij,jk),kl->il” into an EinsumCode.

Type Aliases§

Result
Convenience alias for Result<T, EinsumError>.