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
3 changes: 2 additions & 1 deletion src/solvers/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Base: (*), convert, copy, eltype, getindex, getproperty, show, size,
using Base: require_one_based_indexing

using LinearAlgebra
using LinearAlgebra: RealHermSymComplexHerm, AdjOrTrans
using LinearAlgebra: RealHermSymComplexHerm, AdjOrTrans, AdjOrTransAbsMat
import LinearAlgebra: (\), AdjointFactorization,
cholesky, cholesky!, det, diag, ishermitian, isposdef,
issuccess, issymmetric, ldiv!, ldlt, ldlt!, logdet,
Expand Down Expand Up @@ -1928,6 +1928,7 @@ function \(adjL::AdjointFactorization{<:VTypes,<:Factor}, B::StridedMatrix)
L = adjL.parent
return Matrix(solve(CHOLMOD_A, L, Dense(B)))
end
(\)(adjL::AdjointFactorization{<:VTypes,<:Factor}, B::AdjOrTransAbsMat) = adjL \ copy(B)

const RealHermSymComplexHermSSL{Ti, Tr} = Union{
Symmetric{Tr, SparseMatrixCSC{Tr, Ti}},
Expand Down
15 changes: 15 additions & 0 deletions test/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,21 @@ end
# @test_throws ErrorException cholesky(view(A, :, :), NoPivot())
end

@testset "solve with adjoint factorization and adjoint rhs" begin
n = 10
A = sprand(Tv, n, n, 1/n)
A = A + A' + 10I

B = rand(n, 2)
Bt = Matrix(B')
Bts = sparse(B')

F = cholesky(A)'
@test F \ B ≈ F \ Bt'
@test F \ B ≈ F \ Bts'
@test issparse(F \ Bts')
end

end # for Tv ∈ (Float32, Float64)

end # Base.USE_GPL_LIBS
Expand Down
Loading