Repository navigation
Conversation
cholesky(Symmetric(A, :L)) and solves with its factor passed bandeddata(A) to LAPACK's pbtrf!/pbtrs! with uplo 'L'. LAPACK's lower band storage starts at the diagonal, which a BandedMatrix with upper bandwidth u stores in row u + 1, so for u > 0 LAPACK read a superdiagonal as the diagonal. Both calls now pass the rows from the diagonal down. Fixes JuliaLinearAlgebra#141
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #512 +/- ##
==========================================
+ Coverage 90.69% 90.84% +0.15%
==========================================
Files 27 27
Lines 3784 3814 +30
==========================================
+ Hits 3432 3465 +33
+ Misses 352 349 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cholcopy copied a Symmetric or Hermitian banded matrix into a `similar` one, which leaves the parent's band storage outside the stored triangle uninitialized. For BigFloat those entries are #undef, and on Julia 1.10, where Matrix(::LowerTriangular) copies the whole parent, Matrix(cholesky(Symmetric(A, :L)).L) threw an UndefRefError when A also stored upper bands (likewise for :U with lower bands). cholcopy now zeroes the parent before copying. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
dlfivefifty
requested changes
Oct 15, 2026
Restore the full-parent fill for non-isbits types while skipping it for isbits types. Add regression coverage for both wrappers, triangle orientations, asymmetric bandwidths, and views. Full package tests pass on Julia 1.10.12 and 1.13.0.
Co-authored-by: Sheehan Olver <solver@mac.com>
Removed unnecessary initialization and copying steps in the _banded_cholcopy function.
dlfivefifty
approved these changes
Oct 15, 2026
Initialize parent storage for non-isbits types in _banded_cholcopy function.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cholesky(Symmetric(A, :L))(andHermitian(A, :L)) throws aPosDefExceptionfor a positive definiteBandedMatrixwhose upper bandwidth is positive. Only bandwidths(l, 0)work:Cause
The
LowerTriangularmethod ofbanded_chol!passesbandeddata(A)topbtrf!('L', ...). LAPACK's lower band format expects the diagonal in row 1, but aBandedMatrixwith upper bandwidthustores it in rowu + 1. So LAPACK reads the top superdiagonal as the diagonal. The'L'branch of_ldiv!passes the same storage topbtrs!.Fix
Both calls now pass a view of the band storage from the diagonal row down (
_lower_bandeddata). The leading dimension is unchanged.Tests
A new test factors
Symmetric/Hermitian(A, :L)with bandwidths(2, 1),(2, 2)and(2, 3)forFloat64,ComplexF64andBigFloat, and checks the factor and a solve against dense results. Without this fix, the test errors; with it, it passes, and the full test suite does too. (Note: The existing:Ltests use bandwidths(1, 0)where the two layouts agree, and tests did not catch the bug.(The test compares
Matrix(Ac.L)instead ofAc.Lbecause of an unrelated issue: forBigFloat,Ac.L ≈ ...throws anUndefRefError, since the copycholeskymakes leaves the upper band storage undefined.)Fixes #141.