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)?;Re-exports§
pub use error::EinsumError;pub use error::Result;pub use operand::EinsumOperand;pub use operand::EinsumScalar;pub use operand::StridedData;pub use parse::parse_einsum;pub use parse::EinsumCode;pub use parse::EinsumNode;pub use typed_tensor::needs_c64_promotion;pub use typed_tensor::TypedTensor;
Modules§
- error
- Error types for einsum operations.
- expr
- Recursive contraction-tree evaluation.
- operand
- Type-erased einsum operands (
f64/Complex64, owned / borrowed). - parse
- Nested einsum string parser.
- single_
tensor - Single-tensor operations (permute, trace, diagonal extraction).
- typed_
tensor - Runtime type dispatch over
f64andComplex64tensors.
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.