Skip to content

Conversation

@timholy
Copy link
Contributor

@timholy timholy commented Dec 23, 2025

Packages like NLPModels return Hessians as Symmetric(L, :L) where L
is a sparse lower-triangular matrix. Previously, PDSparseMat only
supported SparseMatrixCSC directly.

This also:

  • Acknowledges that CholTypeSparse is now an abstract type and adds
    its concrete type as a parameter to PDSparseMat.
  • Adds a "coercion cascade" PDSparseMat{T}(args...) -> PDSparseMat{T, S}(args...) -> PDSparseMat{T, S, C}(args...) to force type conversion. This is sometimes needed when one object of a different
    type needs to be converted into some standard type in generic code.
  • Moves size checks into the inner constructor, so that it is impossible
    to create an invalid PDSparseMat.

I expect this to pass tests on 1.10 but fail on 1.12 due to JuliaSparse/SparseArrays.jl#662 (UPDATE: fix already merged, queued for backporting). Before going further, it makes some sense to take a step back and acknowledge other caveats:

Packages like NLPModels return Hessians as `Symmetric(L, :L)` where `L`
is a sparse lower-triangular matrix. Previously, `PDSparseMat` only
supported `SparseMatrixCSC` directly.

This also:
- Acknowledges that `CholTypeSparse` is now an abstract type and adds
  its concrete type as a parameter to `PDSparseMat`.
- Adds a "coercion cascade" `PDSparseMat{T}(args...)` -> `PDSparseMat{T,
  S}(args...)` -> `PDSparseMat{T, S, C}(args...)` to reduce code
  duplication. This is sometimes needed when one object of a different
  type needs to be converted into some standard type in generic code.
- Moves size checks into the inner constructor, so that it is impossible
  to create an invalid `PDSparseMat`.
@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.60%. Comparing base (61c65b1) to head (a9f3916).

Files with missing lines Patch % Lines
src/pdsparsemat.jl 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
- Coverage   93.37%   92.60%   -0.78%     
==========================================
  Files          11       11              
  Lines         800      811      +11     
==========================================
+ Hits          747      751       +4     
- Misses         53       60       +7     

☔ 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.

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