Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cholesky decomposition to nucal._linear_fit #987

Merged
merged 2 commits into from
Jan 29, 2025
Merged

Conversation

tyler-a-cox
Copy link
Contributor

Cholesky decomposition with scipy.linalg.cho_factor can be up to twice as fast as LU decomposition (scipy.linalg.lu_factor). This PR adds solving linear least-squares problems with Cholesky decomposition to nucal._linear_fit which should improve the speed of the function when running with large design matrices.

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.20%. Comparing base (0d72e19) to head (d165336).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #987   +/-   ##
=======================================
  Coverage   97.20%   97.20%           
=======================================
  Files          31       31           
  Lines       11198    11204    +6     
=======================================
+ Hits        10885    10891    +6     
  Misses        313      313           
Flag Coverage Δ
unittests 97.20% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jsdillon jsdillon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'd suggest adding a test that uses the cache (and might as well do it for some of the other solvers while we're at it)

elif solver == "cho_solve":
# Factor XTX using scipy.linalg.cho_factor
if "c_and_lower" in cached_input:
c_and_lower = cached_input.get('c_and_lower')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to add a test that involves caching.

Copy link
Member

@jsdillon jsdillon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@tyler-a-cox tyler-a-cox merged commit 6655c23 into main Jan 29, 2025
9 of 10 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.

2 participants