Expand description
Binary Einstein summation on strided views.
Provides einsum2_into for computing binary tensor contractions with
accumulation semantics: C = alpha * A * B + beta * C.
§Example
use strided_view::StridedArray;
use strided_einsum2::einsum2_into;
// Matrix multiply: C_ik = A_ij * B_jk
let a = StridedArray::<f64>::from_fn_row_major(&[2, 3], |idx| (idx[0] * 3 + idx[1] + 1) as f64);
let b = StridedArray::<f64>::from_fn_row_major(&[3, 2], |idx| (idx[0] * 2 + idx[1] + 1) as f64);
let mut c = StridedArray::<f64>::row_major(&[2, 2]);
einsum2_into(
c.view_mut(), &a.view(), &b.view(),
&['i', 'k'], &['i', 'j'], &['j', 'k'],
1.0, 0.0,
).unwrap();Re-exports§
pub use backend::BackendConfig;pub use backend::BgemmBackend;pub use plan::Einsum2Plan;
Modules§
- backend
- Backend abstraction for batched GEMM dispatch. Backend abstraction for batched GEMM dispatch.
- bgemm_
faer - Batched GEMM backend using the [
faer] library. faer-backed batched GEMM kernel on strided views. - bgemm_
naive - Batched GEMM fallback using explicit loops. Naive batched GEMM kernel on strided views.
- contiguous
- GEMM-ready operand types and preparation functions for contiguous data. GEMM-ready operand types and preparation functions for contiguous data.
- plan
- Contraction planning: axis classification and permutation computation. Einsum2 plan: axis classification and permutation computation.
- trace
- Trace-axis reduction (summing axes that appear only in one operand). Trace-axis reduction for einsum operands.
- util
- Shared helpers (permutation inversion, multi-index iteration, dimension fusion). Shared helpers for strided-einsum2.
Enums§
- Einsum
Error - Errors specific to einsum operations.
Traits§
- AxisId
- Trait alias for axis label types.
- Scalar
- Trait alias for element types supported by einsum operations.
- Scalar
Base - Shared trait bounds for all element types usable with einsum, independent of GEMM backend.
Functions§
- einsum2_
into - Binary einsum contraction:
C = alpha * contract(A, B) + beta * C. - einsum2_
into_ owned - Binary einsum accepting owned inputs for zero-copy optimization.
- einsum2_
naive_ into - Binary einsum for custom scalar types using naive GEMM.
- einsum2_
with_ backend_ into - Binary einsum with a pluggable GEMM backend.
Type Aliases§
- Result
- Convenience alias for
Result<T, EinsumError>.