Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/factorization.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
_ldiv!(x, A, b) = ldiv!(x, A, b)

function _ldiv!(x::Vector, A::Factorization, b::Vector)
# workaround https://github.com/JuliaLang/julia/issues/43507
copyto!(x, b)
Expand Down
3 changes: 2 additions & 1 deletion src/factorization_sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Missing ldiv! definitions: https://github.com/JuliaSparse/SparseArrays.jl/issues/242
function _ldiv!(x::Vector,
A::Union{SparseArrays.QR, LinearAlgebra.QRCompactWY,
SuiteSparse.SPQR.QRSparse}, b::Vector)
SuiteSparse.SPQR.QRSparse,
SuiteSparse.CHOLMOD.Factor}, b::Vector)
x .= A \ b
end

Expand Down
18 changes: 18 additions & 0 deletions test/basictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,24 @@ end
end
end

@testset "CHOLMOD" begin
# Create a posdef symmetric matrix
A = sprand(100, 100, 0.01)
A = A + A' + 100 * I

# rhs
b = rand(100)

# Set the problem
prob = LinearProblem(A, b)
sol = solve(prob)

# Enforce symmetry to use Cholesky, since A is symmetric and posdef
prob2 = LinearProblem(Symmetric(A), b)
sol2 = solve(prob2)
@test abs(norm(A * sol2.u .- b) - norm(A * sol.u .- b)) < 1e-12
end

@testset "Preconditioners" begin
@testset "Vector Diagonal Preconditioner" begin
s = rand(n)
Expand Down