JuliaSmoothOptimizers / JuliaSmoothOptimizers/LDLFactorizations.jl
Factorization fails on strongly factorizable matrix
- Dominant language
- Julia
- Stars
- 36
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug 🐞**
I encounter a `ZeroPivotException` when I try to factorize a KKT matrix of the form
```math
A = \begin{pmatrix}
H & J^T \\
J & 0
\end{pmatrix}
```
even though H is well conditionned and J as well.
**Expected behavior**
The factorization should complete even without pivotting; i have an inertia that indicates that (see below).
EDIT: actually, does it ? I am not sure...
**Minimal Reproducible Example 👇**
Without a minimal reproducible example (MRE), we can only help you to a limited extent, and attention to the issue may be reduced. To learn more about MREs, see [Wikipedia](https://en.wikipedia.org/wiki/Minimal_reproducible_example) and [Stack Overflow](https://stackoverflow.com/help/minimal-reproducible-example).
```julia
using LinearAlgebra, LDLFactorizations, SparseArrays
A = sparse(
[1, 1, 2, 2, 3, 4, 5, 1, 2, 6, 3, 4, 5, 7, 2, 5, 8],
[1, 2, 2, 3, 3, 4, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8],
[2.0001914615384617, -2.0, 4.000191461538462, 2.0, 2.0001914615384617, 2.0001914615384617, 2.0001914615384617, 1.0, 3.0, -0.0, 1.0, 1.0, -2.0, -0.0, 1.0, -1.0, -0.0],
8, 8)
Au = Symmetric(A) # get upper triangle and apply Symmetric wrapper
println(eigvals(Matrix(Au)))
LDL = ldl_analyze(Au) # symbolic analysis
ldl_factorize!(Au, LDL) # factorization
println(factorized(LDL))
```
**Error & Stacktrace ⚠️**
```julia
[-2.745212209707276, -1.7714705196807388, -0.1671971130879379, 1.6791289061976906, 2.1040370160054023, 2.3820003168776873, 3.670773891220806, 6.848897019866673]
false
```
**Environment (please complete the following information):**
- Output of `using Pkg; Pkg.status()`
```julia
Project LDLFactorizations v0.10.2
Status `C:\Users\mgoll\LDLFactorizations.jl\Project.toml`
[14f7f29c] AMD v0.5.3
[37e2e46d] LinearAlgebra v1.12.0
[2f01184e] SparseArrays v1.12.0
[8dfed614] Test v1.11.0
```
- Output of `using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)`
```julia
Project LDLFactorizations v0.10.2
Status `C:\Users\mgoll\LDLFactorizations.jl\Manifest.toml`
[14f7f29c] AMD v0.5.3
[56f22d72] Artifacts v1.11.0
[2a0f44e3] Base64 v1.11.0
[b77e0a4c] InteractiveUtils v1.11.0
[ac6e5ff7] JuliaSyntaxHighlighting v1.12.0
[8f399da3] Libdl v1.11.0
[37e2e46d] LinearAlgebra v1.12.0
[56ddb016] Logging v1.11.0
[d6f4376e] Markdown v1.11.0
[9a3f8284] Random v1.11.0
[ea8e919c] SHA v0.7.0
[9e88b42a] Serialization v1.11.0
[2f01184e] SparseArrays v1.12.0
[f489334b] StyledStrings v1.11.0
[8dfed614] Test v1.11.0
[e66e0078] CompilerSupportLibraries_jll v1.3.0+1
[4536629a] OpenBLAS_jll v0.3.29+0
[bea87d4a] SuiteSparse_jll v7.8.3+2
[8e850b90] libblastrampoline_jll v5.15.0+0
```
- Output of `versioninfo()`
```julia
Julia Version 1.12.1
Commit ba1e628ee4 (2025-10-17 13:02 UTC)
Build Info:
Official https://julialang.org release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 12 × Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
WORD_SIZE: 64
LLVM: libLLVM-18.1.7 (ORCJIT, skylake)
GC: Built with stock GC
Threads: 4 default, 1 interactive, 4 GC (on 12 virtual cores)
Environment:
JULIA_NUM_THREADS = 4
```
**Additional context**
Add any other context about the problem here.
Contributor guide
Research direction
Start by running the minimal reproducer with Julia 1.12.1, then inspect the behavior of ldl_analyze, ldl_factorize!, and factorized for this Symmetric sparse matrix. Determine whether the failure is expected for this matrix and document or correct the factorization behavior, with a regression test covering the reproducer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100