mlx icon indicating copy to clipboard operation
mlx copied to clipboard

Add float64 Eig and complex64 SVD/Eig support (Fixes #2708)

Open harsh-sutariya opened this issue 1 month ago • 1 comments

Proposed changes

Extended dtype support for mlx.linalg.svd and mlx.linalg.eig as requested in #2708.

Changes:

  • Added float64 support for mlx.linalg.eig (CPU)
  • Added complex64 support for mlx.linalg.svd (CPU)
  • Added complex64 support for mlx.linalg.eig (CPU)

Implementation details:

  • Created LAPACK wrapper functions (cgesdd_wrapper, cgeev_wrapper) to handle complex LAPACK signatures with rwork parameters
  • Added template specializations for double and complex<float> in eig.cpp and svd.cpp
  • Extended unit tests in test_linalg.py to cover new dtypes

Limitations:

  • GPU support not included (CPU only implementation)
  • complex128 not supported (MLX doesn't define this dtype)

Checklist

Put an x in the boxes that apply.

  • [x] I have read the CONTRIBUTING document
  • [x] I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] I have updated the necessary documentation (if needed)

harsh-sutariya avatar Nov 05 '25 23:11 harsh-sutariya

Thanks for the review and feedback! I've refactored code and made the necessary changes. I request you to review them again.

harsh-sutariya avatar Nov 06 '25 21:11 harsh-sutariya

Hi @awni, just checking in. I've addressed all the requested changes and pushed the updates. Whenever you get a moment, could you please review the latest commits? Thanks!

harsh-sutariya avatar Nov 20 '25 15:11 harsh-sutariya

Yup, sorry for the delay.

awni avatar Nov 20 '25 15:11 awni