Skip to content

Commit b6487a2

Browse files
committed
Update
1 parent e9b6db5 commit b6487a2

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

ext/MathOptInterfaceLDLFactorizationsExt.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ function MOI.Bridges.Constraint.compute_sparse_sqrt_fallback(
2121
) where {F<:MOI.ScalarQuadraticFunction,S<:MOI.AbstractSet}
2222
n = LinearAlgebra.checksquare(Q)
2323
factor = LDLFactorizations.ldl(Q)
24-
if !LDLFactorizations.factorized(factor) || minimum(factor.D) < 0
24+
# Ideally we should use `LDLFactorizations.factorized(factor)` here, but it
25+
# has some false negatives. Instead we check that the factorization appeared
26+
# to work. This is a heuristic. There might be other cases where check is
27+
# insufficient.
28+
if minimum(factor.D) < 0 || any(issubnormal, factor.D)
2529
msg = """
2630
Unable to transform a quadratic constraint into a SecondOrderCone
2731
constraint because the quadratic constraint is not convex.

test/Bridges/Constraint/test_QuadtoSOCBridge.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,11 @@ function test_compute_sparse_sqrt_edge_cases()
363363
[1.0 0.0; 0.0 2.0],
364364
# Cholesky works, with pivoting
365365
[1.0 0.0 1.0; 0.0 1.0 1.0; 1.0 1.0 3.0],
366-
# Cholesky fails due to 0 eigen value
366+
# Cholesky fails due to 0 eigen value. LDL works
367367
[1.0 1.0; 1.0 1.0],
368368
# Cholesky succeeds, even though 0 eigen value
369369
[2.0 2.0; 2.0 2.0],
370-
# Cholesky fails because of 0 column/row
370+
# Cholesky fails because of 0 column/row. LDL works
371371
[2.0 0.0; 0.0 0.0],
372372
]
373373
B = SparseArrays.sparse(A)

0 commit comments

Comments
 (0)