Skip to content

Commit 6b50890

Browse files
authored
do not call ldlt! in the poly algorithm for hermitian matrices (#325)
1 parent a3116b9 commit 6b50890

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

src/solvers/cholmod.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,12 +1577,7 @@ function \(A::RealHermSymComplexHermF64SSL, B::StridedVecOrMatInclAdjAndTrans)
15771577
if issuccess(F)
15781578
return \(F, B)
15791579
else
1580-
ldlt!(F, A; check = false)
1581-
if issuccess(F)
1582-
return \(F, B)
1583-
else
1584-
return \(lu(SparseMatrixCSC{eltype(A), SuiteSparse_long}(A)), B)
1585-
end
1580+
return \(lu(SparseMatrixCSC{eltype(A), SuiteSparse_long}(A)), B)
15861581
end
15871582
end
15881583

test/cholmod.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,30 @@ end
927927
end
928928
end
929929

930+
@testset "sym indefinite poly alg" begin
931+
K = open(joinpath(@__DIR__, "matrices", "stiffness_sym_indef")) do io
932+
ml = readline(io)
933+
m = parse(Int, split(ml, "m = ")[2])
934+
nl = readline(io)
935+
n = parse(Int, split(nl, "n = ")[2])
936+
937+
colptrl = readline(io)
938+
rowvall = readline(io)
939+
nzvall = readline(io)
940+
941+
colptr = parse.(Int, split(strip(split(colptrl, "colptr = ")[2], [']', '[']), ','))
942+
rowval = parse.(Int, split(strip(split(rowvall, "rowval = ")[2], [']', '[']), ','))
943+
nzval = parse.(Float64, split(strip(split(nzvall, "nzval = ")[2], [']', '[']), ','))
944+
945+
SparseMatrixCSC(m, n, colptr, rowval, nzval)
946+
end
947+
948+
f = ones(size(K, 1))
949+
u = K \ f
950+
residual = norm(f - K * u) / norm(f)
951+
@test residual < 1e-6
952+
end
953+
930954
end # Base.USE_GPL_LIBS
931955

932956
end # module

0 commit comments

Comments
 (0)