Skip to content

Commit

Permalink
use LazySets for expv
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Apr 24, 2023
1 parent 7ebaa11 commit 6a9a1f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/Discretization/exponentiation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,14 @@ function _Φ₁_u(A, δ, alg, u::AbstractVector, Φ=nothing)
return A \ x
end

function load_Φ₁_krylov()
return quote

# compute Φ₁(A, δ)u = A^{-1}(exp(Aδ) - I) u without explicitly computing exp(Aδ)
# and assuming that A is invertible
function _Φ₁_u(A, δ, alg::LazyExpAlg, u::AbstractVector, ::Nothing)
w = expv(1.0 * δ, A, u, m=alg.m, tol=alg.tol)
w = LazySets._expmv(δ, A, u; m=alg.m, tol=alg.tol)
x = w - u
return A \ x
end

end end # quote / load_Φ₁_krylov()

"""
Φ₂(A::AbstractMatrix, δ, [alg]::AbstractExpAlg=BaseExp, [isinv]::Bool=false, [Φ]=nothing)
Expand Down
3 changes: 1 addition & 2 deletions src/Initialization/init_ExponentialUtilities.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
eval(quote
using .ExponentialUtilities: expv, expv!, phiv!, arnoldi!, KrylovSubspace
using .ExponentialUtilities: expv!, phiv!, arnoldi!, KrylovSubspace

# Compute out <- exp(A * NSTEPS * dt) * b
function _expv(A, b, NSTEPS, dt; hermitian=false, m=min(30, size(A, 1)), tol=1e-7)
Expand Down Expand Up @@ -29,6 +29,5 @@ function _phiv(A, b, NSTEPS, dt; hermitian=false, m=min(30, size(A, 1)), tol=1e-
end
end)

eval(load_Φ₁_krylov())
eval(load_krylov_LGG09_homog())
eval(load_krylov_LGG09_inhomog())

0 comments on commit 6a9a1f9

Please sign in to comment.