Skip to content

Commit

Permalink
Merge pull request #3310 from JuliaReach/schillic/expv
Browse files Browse the repository at this point in the history
Allow to pass kwargs to _expmv and add method with default backend
  • Loading branch information
schillic authored Apr 23, 2023
2 parents 679ee52 + d69a0c9 commit 072e74a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Utils/matrix_exponential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ function get_exponential_backend()
return exponential_backend
end

# use default backend
function _expmv(t, A, b; kwargs...)
backend = get_exponential_backend()
return _expmv(backend, t, A, b; kwargs...)
end

# ====================
# ExponentialUtilities
# ====================
Expand All @@ -30,8 +36,8 @@ end

end end # quote / load_exponentialutilities

function _expmv(::Val{:ExponentialUtilities}, t, A, b)
return ExponentialUtilities.expv(t, A, b)
function _expmv(::Val{:ExponentialUtilities}, t, A, b; kwargs...)
return ExponentialUtilities.expv(t, A, b; kwargs...)
end

# =======
Expand All @@ -47,11 +53,11 @@ end

end end # quote / load_expokit

function _expmv(::Val{:Expokit}, t, A, b::Vector)
return Expokit.expmv(t, A, b)
function _expmv(::Val{:Expokit}, t, A, b::Vector; kwargs...)
return Expokit.expmv(t, A, b; kwargs...)
end

function _expmv(backend::Val{:Expokit}, t, A, b)
function _expmv(backend::Val{:Expokit}, t, A, b; kwargs...)
b = Vector(b) # Expokit requires a dense vector
return _expmv(backend, t, A, b)
return _expmv(backend, t, A, b; kwargs...)
end

0 comments on commit 072e74a

Please sign in to comment.