diff --git a/src/krylov_utils.jl b/src/krylov_utils.jl index a1805b66c..c296350da 100644 --- a/src/krylov_utils.jl +++ b/src/krylov_utils.jl @@ -180,13 +180,18 @@ 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 + str = string(S) + vec = SubString(str, 1, findfirst("{", str).start-1) + if vec ∈ ("BlockVector", "Zeros", "SparseVector") + S = Vector{T} + end + if vec == "CuSparseVector" + S = CuVector{T} end return S end