Skip to content

Conversation

@dkarrasch
Copy link
Member

This adds a generic version of cholesky for tridiagonal matrices. This fixes #1383, and massively boosts performance both for (Sym)Tridiagonals. Previously, we haven't had a kernel for the symtridiagonal case.

@dkarrasch dkarrasch requested a review from araujoms August 8, 2025 16:42
@codecov
Copy link

codecov bot commented Aug 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.87%. Comparing base (16f64e7) to head (d1978ef).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1409   +/-   ##
=======================================
  Coverage   93.86%   93.87%           
=======================================
  Files          34       34           
  Lines       15830    15852   +22     
=======================================
+ Hits        14859    14881   +22     
  Misses        971      971           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@araujoms
Copy link
Collaborator

Getting the generic version is even better than just calling pttrf, but isn't that worth it for BlasFloat?

@dkarrasch
Copy link
Member Author

Thanks for your review. That was helpful!

Getting the generic version is even better than just calling pttrf, but isn't that worth it for BlasFloat?

I'll need to benchmark that.

@dkarrasch
Copy link
Member Author

So, to give an update: I replaced the LAPACK-call to the ldlt-routine by the Julia code that we use in the ldlt-module. Apparently, we don't reach out to LAPACK for that either, even though pttrf! exists. I merged that loop with your corresponding two lines map!(sqrt, d); e .*= d. For Float64, performance is the same as in the last but one commit with the explicit LAPACK calls, which is faster than my initial simple "reduction of the dense algorithm". The reason, after all, for that is that we want to be able to avoid throws when check=false, which would be impossible with the LAPACK call.

@araujoms
Copy link
Collaborator

It would be possible to edit the pttrf wrapper, as it was done with the potrf wrapper, but since the performance is similar it's better to avoid a ccall anyway.

@dkarrasch dkarrasch merged commit aaa7688 into master Aug 12, 2025
4 checks passed
@dkarrasch dkarrasch deleted the dk/banded_chol branch August 12, 2025 16:25
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.

Cholesky factorization of a Tridiagonal matrix should not be dense

2 participants