-
Notifications
You must be signed in to change notification settings - Fork 0
Extract common pipeline from einsum2 entry points in lib.rs #121
Copy link
Copy link
Open
Description
Summary
strided-einsum2/src/lib.rs has 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 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels