Skip to content

Bug fixes, performance improvements, and test coverage#17

Merged
flaport merged 14 commits intomainfrom
fixes
Jan 20, 2026
Merged

Bug fixes, performance improvements, and test coverage#17
flaport merged 14 commits intomainfrom
fixes

Conversation

@flaport
Copy link
Owner

@flaport flaport commented Jan 20, 2026

Summary

  • Fix C++ memory safety issues: add null checks after klu_factor, use RAII with std::unique_ptr for automatic cleanup, and check Common.status after KLU operations
  • Fix incorrect error messages (n_lhs -> n_nz mismatch) and add negative index validation
  • Add error handling in JVP functions when trying to differentiate w.r.t. sparse indices Ai/Aj
  • Improve dot operation performance by ~4x via loop reordering for better cache locality
  • Add klujax.dot to the parametrized test suite (previously only solve was tested)
  • Fix test matrices to be invertible by adding strong diagonal (prevents singular matrix errors)
  • Update pre-commit hooks and switch from Makefile to justfile

Test plan

  • All 36 tests pass (make test / just test)
  • Benchmarked dot operation: ~4.3x speedup (2159ms -> 504ms mean per iteration)
  • Verified singular matrix detection works correctly

🤖 Generated with Claude Code

@flaport flaport merged commit 56b4a11 into main Jan 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant