Skip to content

Commit

Permalink
Define resize! on factorization methods
Browse files Browse the repository at this point in the history
Generalize the linear solver interface by allowing cache resizing, which right now just does cache invalidation.
  • Loading branch information
ChrisRackauckas committed Jul 4, 2021
1 parent 75a0c75 commit aa3eab8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/linear_nonlinear.jl
Expand Up @@ -41,6 +41,7 @@ end
function (p::LinSolveFactorize)(::Type{Val{:init}},f,u0_prototype)
LinSolveFactorize(p.factorization,nothing)
end
Base.resize!(p::LinSolveFactorize,i) = p.A = nothing

mutable struct LinSolveGPUFactorize{F,T}
factorization::F
Expand All @@ -58,6 +59,7 @@ end
function (p::LinSolveGPUFactorize)(::Type{Val{:init}},f,u0_prototype)
LinSolveGPUFactorize(p.factorization,nothing,cuify(u0_prototype))
end
Base.resize!(p::LinSolveGPUFactorize,i) = p.A = nothing

### Default Linsolve

Expand Down Expand Up @@ -149,6 +151,7 @@ function (p::DefaultLinSolve)(::Type{Val{:init}},f,u0_prototype)
end
end

Base.resize!(p::DefaultLinSolve,i) = p.A = nothing
const DEFAULT_LINSOLVE = DefaultLinSolve()

### Default GMRES
Expand Down Expand Up @@ -264,3 +267,7 @@ function purge_history!(iter::IterativeSolvers.GMRESIterable, x, b)
iter.β = iter.residual.current
nothing
end

function Base.resize!(f::LinSolveIterativeSolvers,i)
f.iterable = nothing
end

0 comments on commit aa3eab8

Please sign in to comment.