Summary
strided-einsum2/src/lib.rs has 4 public einsum2 functions that duplicate the entire pipeline:
einsum2_into() — generic Scalar with ElementOp
einsum2_naive_into() — custom ScalarBase with closures
einsum2_with_backend_into() — custom backend dispatch
einsum2_into_owned() — owned arrays with conjugation
Each repeats: plan creation → dimension validation → trace reduction → permutation → fast-path check → contiguous prep → GEMM dispatch.
Proposal
Extract the common pipeline into a single internal einsum2_core() function. The 4 public functions become thin wrappers that provide type-specific parameters. Estimated ~300 lines reduction.
Risk
Medium. Requires careful trait design to avoid excessive indirection, but the benefit (single source of truth, easier maintenance) is substantial.
Summary
strided-einsum2/src/lib.rshas 4 public einsum2 functions that duplicate the entire pipeline:einsum2_into()— generic Scalar with ElementOpeinsum2_naive_into()— custom ScalarBase with closureseinsum2_with_backend_into()— custom backend dispatcheinsum2_into_owned()— owned arrays with conjugationEach repeats: plan creation → dimension validation → trace reduction → permutation → fast-path check → contiguous prep → GEMM dispatch.
Proposal
Extract the common pipeline into a single internal
einsum2_core()function. The 4 public functions become thin wrappers that provide type-specific parameters. Estimated ~300 lines reduction.Risk
Medium. Requires careful trait design to avoid excessive indirection, but the benefit (single source of truth, easier maintenance) is substantial.