Skip to content

Commit

Permalink
Merge pull request Jutho#53 from emstoudenmire/use_initial_apply
Browse files Browse the repository at this point in the history
Reuse initial apply in expintegrator
  • Loading branch information
Jutho authored Mar 20, 2022
2 parents d154a5f + efc4e2c commit 66a9439
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/matrixfun/expintegrator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ function expintegrator(A, t::Number, u::Tuple, alg::Union{Lanczos,Arnoldi})
# initial vectors
w = Vector{typeof(w₀)}(undef, p + 1)
w[1] = w₀
# reuse the result of apply computed earlier:
w[2] = mul!(similar(w₀), Au₀, one(T))
for j in 1:p
w[j+1] = apply(A, w[j])
numops += 1
if j > 1
w[j+1] = apply(A, w[j])
numops += 1
end
lfac = 1
for l in 0:p-j
w[j+1] = axpy!((sgn * τ₀)^l / lfac, u[j+l+1], w[j+1])
Expand Down

0 comments on commit 66a9439

Please sign in to comment.