Skip to content

Allow more specialized linalg.solve assume_a cases #1273

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

Merged
merged 4 commits into from
Mar 18, 2025

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Mar 6, 2025

Accompanying notebook: https://gist.github.com/ricardoV94/005fb4b48d274bcf383a3eb5456462d3

Also fixes #1271

We want to implement solve_banded and solveh_banded, which allows working directly with the sparse representation of the matrix which is much more practical. Will do that in a follow up PR as it requires more work.

Would also be nice to implement the tridiagonal / banded solvers for numba.


📚 Documentation preview 📚: https://pytensor--1273.org.readthedocs.build/en/1273/

@ricardoV94 ricardoV94 force-pushed the more_solves branch 4 times, most recently from 55d0b79 to 41c2131 Compare March 6, 2025 17:46
@ricardoV94 ricardoV94 force-pushed the more_solves branch 4 times, most recently from b70fca9 to 8002c87 Compare March 18, 2025 06:22
@ricardoV94 ricardoV94 marked this pull request as ready for review March 18, 2025 06:57
@ricardoV94 ricardoV94 added numba bug Something isn't working and removed numba labels Mar 18, 2025
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 64.28571% with 20 lines in your changes missing coverage. Please review.

Project coverage is 82.00%. Comparing base (42a7adb) to head (766038b).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pytensor/link/jax/dispatch/slinalg.py 35.71% 7 Missing and 2 partials ⚠️
pytensor/link/numba/dispatch/slinalg.py 11.11% 8 Missing ⚠️
pytensor/tensor/slinalg.py 90.62% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1273      +/-   ##
==========================================
- Coverage   82.01%   82.00%   -0.01%     
==========================================
  Files         188      188              
  Lines       48442    48478      +36     
  Branches     8659     8665       +6     
==========================================
+ Hits        39730    39755      +25     
- Misses       6566     6575       +9     
- Partials     2146     2148       +2     
Files with missing lines Coverage Δ
pytensor/tensor/basic.py 91.14% <100.00%> (ø)
pytensor/tensor/slinalg.py 93.38% <90.62%> (-0.29%) ⬇️
pytensor/link/numba/dispatch/slinalg.py 44.44% <11.11%> (+0.02%) ⬆️
pytensor/link/jax/dispatch/slinalg.py 81.63% <35.71%> (-13.37%) ⬇️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jessegrabowski jessegrabowski left a comment

Choose a reason for hiding this comment

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

Minor suggestions

transposed=False,
check_finite=True,
lower: bool = False,
overwrite_a: bool = False,
Copy link
Member

Choose a reason for hiding this comment

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

I thought we decided not to expose this option to users?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't. The docstrings specify it's ignored and PyTensor will perform inplace if possible. This way the signature is the same for the user.

@ricardoV94 ricardoV94 force-pushed the more_solves branch 2 times, most recently from 71e0518 to 0519629 Compare March 18, 2025 10:16
@ricardoV94 ricardoV94 merged commit a149f6c into pymc-devs:main Mar 18, 2025
72 of 73 checks passed
@ricardoV94 ricardoV94 added the enhancement New feature or request label Mar 18, 2025
@ricardoV94 ricardoV94 changed the title Allow more specialized solve routines Allow more specialized linalg.solve assume_a cases Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request linalg Linear algebra SciPy compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numba symmetrical solve prints spurious ill-conditioned matrix
2 participants