From 6a9a1f913c6df3607cc9ea68c54479240f43dfa4 Mon Sep 17 00:00:00 2001 From: schillic Date: Sat, 22 Apr 2023 22:37:20 +0200 Subject: [PATCH] use LazySets for expv --- src/Discretization/exponentiation.jl | 7 +------ src/Initialization/init_ExponentialUtilities.jl | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Discretization/exponentiation.jl b/src/Discretization/exponentiation.jl index 71bb571d2a..62e9bcc436 100644 --- a/src/Discretization/exponentiation.jl +++ b/src/Discretization/exponentiation.jl @@ -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) diff --git a/src/Initialization/init_ExponentialUtilities.jl b/src/Initialization/init_ExponentialUtilities.jl index 700a78a547..cfb6c3141a 100644 --- a/src/Initialization/init_ExponentialUtilities.jl +++ b/src/Initialization/init_ExponentialUtilities.jl @@ -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) @@ -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())