ndarray icon indicating copy to clipboard operation
ndarray copied to clipboard

Tensordot implementation

Open jmg049 opened this issue 1 month ago • 0 comments

Tensordot implementation Issue #1517

Adds a full implementation of tensordot for n-dimensional arrays, supporting both numeric and paired axis specifications via the new AxisSpec enum. The design mirrors NumPy’s tensordot behaviour while integrating cleanly with ndarray’s trait-based approach for the dot product and existing shape and stride logic.

All internal reshaping and permutation operations use unwrap and expect with explicit safety reasoning: each call is guarded by dimension and axis validation, ensuring panics can only occur under invalid AxisSpec input. Documentation and inline comments describe these invariants and the exact failure conditions.

Includes tests verifying correct contraction for both paired and integer axis modes.

jmg049 avatar Nov 08 '25 16:11 jmg049