Skip to content

Commit 7af698e

Browse files
authored
Enhance comments in compute_sparse_sqrt function
Added comments to clarify the purpose of the try-catch block in compute_sparse_sqrt function.
1 parent 19acb0a commit 7af698e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Bridges/Constraint/bridges/QuadtoSOCBridge.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ function compute_sparse_sqrt_fallback(Q, ::F, ::S) where {F,S}
8080
end
8181

8282
function compute_sparse_sqrt(Q, func, set)
83+
# There's a big try-catch here because `cholesky` can fail even if
84+
# `check = false`. As one example, it currently (v1.12) fails with
85+
# `BigFloat`. Similarly, we want to guard against errors in
86+
# `compute_sparse_sqrt_fallback`.
87+
#
88+
# The try-catch isn't a performance concern because the alternative is not
89+
# being able to reformulate the problem.
8390
try
8491
factor = LinearAlgebra.cholesky(Q; check = false)
8592
if !LinearAlgebra.issuccess(factor)

0 commit comments

Comments
 (0)