Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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 @@
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 @@
L = adjL.parent
return Matrix(solve(CHOLMOD_A, L, Dense(B)))
end
(\)(adjL::AdjointFactorization{<:VTypes,<:Factor}, B::AdjOrTransAbsMat) = adjL \ copy(B)

Check warning on line 1931 in src/solvers/cholmod.jl

View check run for this annotation

Codecov / codecov/patch

src/solvers/cholmod.jl#L1931

Added line #L1931 was not covered by tests

const RealHermSymComplexHermSSL{Ti, Tr} = Union{
Symmetric{Tr, SparseMatrixCSC{Tr, Ti}},
Expand Down
17 changes: 16 additions & 1 deletion test/cholmod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using SparseArrays.CHOLMOD: getcommon
using Random
using Serialization
using LinearAlgebra:
I, cholesky, cholesky!, det, diag, eigmax, ishermitian, isposdef, issuccess,
I, cholesky, cholesky!, det, diag, eigmax, ishermitian, isposdef, issuccess, factorize,
issymmetric, ldiv!, ldlt, ldlt!, logdet, norm, opnorm, Diagonal, Hermitian, Symmetric,
PosDefException, ZeroPivotException, RowMaximum
using SparseArrays
Expand Down 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