Expand description
N-ary Einstein summation for ndarray arrays.
This crate provides a thin wrapper over strided_opteinsum that accepts
ndarray ArrayD<T> and ArrayViewD<T> types directly.
Dims and strides are passed through without reversal (ndarray has explicit strides).
§Example
ⓘ
use ndarray::ArrayD;
use ndarray_opteinsum::einsum;
let a = ArrayD::from_shape_vec(vec![2, 3], (1..=6).map(|x| x as f64).collect()).unwrap();
let b = ArrayD::from_shape_vec(vec![3, 2], (7..=12).map(|x| x as f64).collect()).unwrap();
let c: ArrayD<f64> = einsum("ij,jk->ik", vec![(&a).into(), (&b).into()]).unwrap();Modules§
Enums§
- Error
- Error type for ndarray-opteinsum operations.
- NdOperand
- A type-erased einsum operand wrapping ndarray types.
Functions§
- einsum
- Parse and evaluate an einsum expression on ndarray operands.
- einsum_
into - Parse and evaluate an einsum expression, writing the result into a pre-allocated ndarray output with alpha/beta scaling.