LDLFactorizations.jl
LDLFactorizations.jl copied to clipboard
possible method error upper triangle
n, m = size(A)
A = sprand(Float64, 10, 5, 0.25)
λ = 1.0e-3
K1 = triu([sparse(1.0I,n,n) A; A' -λ^2 * I])
S1 = ldl(Symmetric(K1, :U))
K2 = [sparse(1.0I,n,n) A; A' -λ^2 * I]
S2 = ldl(Symmetric(K2, :U))
b = ones(m+n)
norm(S1 \ b - S2 \ b) # not zero
Hi! I think this may be a method error. Do we still need L521 - L577 ?
There's an undocumented assumption that if your matrix isn't Symmetric, it only stores one triangle, so the call with K2 is technically a user error (though I agree that it's difficult to blame the user in this case!). In my opinion, the entire point of Symmetric should be to allow users to only store one triangle while having a matrix that behaves like a symmetric matrix.
So we should really add documentation here, and perhaps a check somewhere to warn the user if they issue such a call.