Skip to content

fix: support float16 operands in sparse dot products - #1040

Open
AryanRG wants to merge 1 commit into
pydata:mainfrom
AryanRG:fix/float16-sparse-matrix-products
Open

AryanRG wants to merge 1 commit into
pydata:mainfrom
AryanRG:fix/float16-sparse-matrix-products

Conversation

@AryanRG

@AryanRG AryanRG commented Dec 1, 2026

Copy link
Copy Markdown

What type of PR is this?

  • 🐞 Bug Fix
  • 🧪 Test

Related issues

Closes #263.

Checklist

  • Code follows style guide
  • Tests added
  • Documented the changes

Changes

Multiplying two float16 COO matrices raises NotImplementedError: float16 in Numba. Promote half-precision operands to float32 for the calculation, then round the completed product to NumPy’s result dtype. For COO and GCXS arrays, cast the stored values and the fill value directly so the calculation preserves their sparse representation.

The dot regression covers two products that exceed the float16 range and cancel in the sum. The tensordot tests cover stored COO, DOK and GCXS scalars and a requested GCXS result with zero rows. Scalar multiplication takes its existing path before the kernel promotes either operand.

The default Numba suite and doctests had 7,733 passing tests, 15 skips, 98 expected failures and 56 unexpected passes.

@github-actions github-actions Bot added the fix label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dtype: NotImplementedError: float16

1 participant