Skip to content

Commit 0d2d30a

Browse files
authored
Keep Hermitian(::Sparse) \ SparseArray throwing (#322)
1 parent 760989e commit 0d2d30a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/abstractsparse.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ of type `Tv` and index type `Ti`. Alias for `AbstractSparseArray{Tv,Ti,2}`.
3232
"""
3333
const AbstractSparseMatrix{Tv,Ti} = AbstractSparseArray{Tv,Ti,2}
3434

35+
const AbstractSparseVecOrMat = Union{AbstractSparseVector,AbstractSparseMatrix}
36+
3537
"""
3638
AbstractSparseMatrixCSC{Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}
3739

src/solvers/cholmod.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ import Base: (*), convert, copy, eltype, getindex, getproperty, show, size,
1515
using Base: require_one_based_indexing
1616

1717
using LinearAlgebra
18+
using LinearAlgebra: RealHermSymComplexHerm, AdjOrTrans
1819
import LinearAlgebra: (\),
1920
cholesky, cholesky!, det, diag, ishermitian, isposdef,
2021
issuccess, issymmetric, ldlt, ldlt!, logdet
2122

2223
using SparseArrays
23-
using SparseArrays: getcolptr
24+
using SparseArrays: getcolptr, AbstractSparseVecOrMat
2425
import Libdl
2526

2627
export
@@ -1610,6 +1611,11 @@ function \(A::RealHermSymComplexHermF64SSL, B::StridedVecOrMatInclAdjAndTrans)
16101611
end
16111612
end
16121613

1614+
const AbstractSparseVecOrMatInclAdjAndTrans = Union{AbstractSparseVecOrMat, AdjOrTrans{<:Any, <:AbstractSparseVecOrMat}}
1615+
\(::RealHermSymComplexHermF64SSL, ::AbstractSparseVecOrMatInclAdjAndTrans) =
1616+
throw(ArgumentError("self-adjoint sparse system solve not implemented for sparse rhs B," *
1617+
" consider to convert B to a dense array"))
1618+
16131619
## Other convenience methods
16141620
function diag(F::Factor{Tv}) where Tv
16151621
f = unsafe_load(pointer(F))

src/solvers/umfpack.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export UmfpackLU
66

77
import Base: (\), getproperty, show, size
88
using LinearAlgebra
9+
using LinearAlgebra: AdjOrTrans
910
import LinearAlgebra: Factorization, checksquare, det, logabsdet, lu, lu!, ldiv!
1011

1112
using SparseArrays
@@ -399,8 +400,8 @@ lu(A::Union{AbstractSparseMatrixCSC{T},AbstractSparseMatrixCSC{Complex{T}}};
399400
lu(A::AbstractSparseMatrixCSC; check::Bool = true) = lu(float(A); check = check)
400401

401402
# We could do this as lu(A') = lu(A)' with UMFPACK, but the user could want to do one over the other
402-
lu(A::Union{Adjoint{T, S}, Transpose{T, S}}; check::Bool = true) where {T<:UMFVTypes, S<:AbstractSparseMatrixCSC{T}} =
403-
lu(copy(A); check)
403+
lu(A::AdjOrTrans{T,S}; check::Bool = true) where {T<:UMFVTypes, S<:AbstractSparseMatrixCSC{T}} =
404+
lu(copy(A); check)
404405

405406
"""
406407
lu!(F::UmfpackLU, A::AbstractSparseMatrixCSC; check=true, reuse_symbolic=true, q=nothing) -> F::UmfpackLU

0 commit comments

Comments
 (0)