Skip to content

Commit

Permalink
Update ktypeof function to support BlockArrays and FillArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Aug 16, 2022
1 parent 56196d7 commit b96ff11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/krylov_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,17 @@ end
Return a dense storage type `S` based on the type of `v`.
"""
function ktypeof(v :: AbstractVector)
function ktypeof(v :: AbstractVector{T}) where T
S = typeof(v)
if S <: SubArray
S = S.types[1] # SubArray
S = S.types[1]
end
if S <: AbstractSparseVector
S = S <: SparseVector ? S.types[3] : S.types[2] # SparseVector / CuSparseVector
if !(S <: DenseVector)
if S <: AbstractSparseVector
S = S <: SparseVector ? S.types[3] : S.types[2] # SparseVector / CuSparseVector
else
S = Vector{T}
end
end
return S
end
Expand Down

0 comments on commit b96ff11

Please sign in to comment.