Skip to content

Commit 45118a5

Browse files
hotfix a few more default cases
1 parent 73a1395 commit 45118a5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LinearSolve"
22
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
33
authors = ["SciML"]
4-
version = "2.1.7"
4+
version = "2.1.8"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/factorization.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,8 @@ function init_cacheval(alg::UMFPACKFactorization, A, b, u, Pl, Pr, maxiters::Int
699699
return SuiteSparse.UMFPACK.UmfpackLU(SparseMatrixCSC(size(A)..., getcolptr(A),
700700
rowvals(A), nonzeros(A)))
701701
end
702-
702+
elseif !(eltype(A) <: Union{Float32,Float64}) || !(eltype(b) <: Union{Float32,Float64})
703+
return nothing # Cannot use Umfpack
703704
else
704705
@static if VERSION < v"1.9.0-DEV.1622"
705706
res = SuiteSparse.UMFPACK.UmfpackLU(C_NULL, C_NULL, 0, 0,
@@ -782,6 +783,8 @@ function init_cacheval(alg::KLUFactorization, A, b, u, Pl, Pr, maxiters::Int, ab
782783
if typeof(A) <: SparseArrays.AbstractSparseArray
783784
return KLU.KLUFactorization(SparseMatrixCSC(size(A)..., getcolptr(A), rowvals(A),
784785
nonzeros(A)))
786+
elseif !(eltype(A) <: Union{Float32,Float64}) || !(eltype(b) <: Union{Float32,Float64})
787+
return nothing # Cannot use KLU
785788
else
786789
return KLU.KLUFactorization(SparseMatrixCSC(0, 0, [1], Int64[], eltype(A)[]))
787790
end
@@ -1102,7 +1105,7 @@ end
11021105

11031106
function SciMLBase.solve!(cache::LinearCache, alg::DiagonalFactorization;
11041107
kwargs...)
1105-
A = cache.A
1108+
A = convert(AbstractMatrix, cache.A)
11061109
if cache.u isa Vector && cache.b isa Vector
11071110
@simd ivdep for i in eachindex(cache.u)
11081111
cache.u[i] = A.diag[i] \ cache.b[i]

0 commit comments

Comments
 (0)