Skip to content

Commit

Permalink
Rebase of #28526 on master (#34989)
Browse files Browse the repository at this point in the history
* fix \ SparseVector

* split (\) for sparsevector;
test for Factor and Symmetric Sparse Matrix

Co-authored-by: Chi Po Choi <[email protected]>
  • Loading branch information
ViralBShah and pochoi authored Mar 5, 2020
1 parent 598209d commit d2f9677
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdlib/SuiteSparse/src/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,8 @@ end

(\)(L::Factor, B::Sparse) = spsolve(CHOLMOD_A, L, B)
# When right hand side is sparse, we have to ensure that the rhs is not marked as symmetric.
(\)(L::Factor, B::SparseVecOrMat) = sparse(spsolve(CHOLMOD_A, L, Sparse(B, 0)))
(\)(L::Factor, B::SparseMatrixCSC) = sparse(spsolve(CHOLMOD_A, L, Sparse(B, 0)))
(\)(L::Factor, B::SparseVector) = sparse(spsolve(CHOLMOD_A, L, Sparse(B)))

\(adjL::Adjoint{<:Any,<:Factor}, B::Dense) = (L = adjL.parent; solve(CHOLMOD_A, L, B))
\(adjL::Adjoint{<:Any,<:Factor}, B::Sparse) = (L = adjL.parent; spsolve(CHOLMOD_A, L, B))
Expand Down
10 changes: 10 additions & 0 deletions stdlib/SuiteSparse/test/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,16 @@ end
@test A\view(Matrix(1.0I, 5, 5), :, :) Matrix(Diagonal(x))
end

@testset "Test \\ for Factor and SparseVecOrMat" begin
sparseI = sparse(1.0I, 100, 100)
sparseb = sprandn(100, 0.5)
sparseB = sprandn(100, 100, 0.5)
chI = cholesky(sparseI)
@test chI \ sparseb sparseb
@test chI \ sparseB sparseB
@test chI \ sparseI sparseI
end

@testset "Real factorization and complex rhs" begin
A = sprandn(5, 5, 0.4) |> t -> t't + I
B = complex.(randn(5, 2), randn(5, 2))
Expand Down

2 comments on commit d2f9677

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.