diff --git a/src/Continuous/discretization.jl b/src/Continuous/discretization.jl index a5da200e2..4770d0ff0 100644 --- a/src/Continuous/discretization.jl +++ b/src/Continuous/discretization.jl @@ -42,7 +42,7 @@ function discretize(ivp::IVP{<:CLCS, <:LazySet}, δ::Float64, alg::Forward) Phi2A_abs = Φ₂(A_abs, δ, alg.phi2_method) # "forward" algorithm, uses E⁺ - @assert alg.sih_method == "concrete" + @assert alg.sih_method == :concrete # TODO : specialize, add option to compute the concrete linear map Einit = symmetric_interval_hull(Phi2A_abs * symmetric_interval_hull((A * A) * X0)) @@ -62,7 +62,7 @@ function discretize(ivp::IVP{<:CLCCS, <:LazySet}, δ::Float64, alg::Forward) A_abs = _elementwise_abs(A) Phi2A_abs = Φ₂(A_abs, δ, alg.phi2_method) - @assert alg.sih_method == "concrete" + @assert alg.sih_method == :concrete # TODO : specialize, add option to compute the concrete linear map Einit = symmetric_interval_hull(Phi2A_abs * symmetric_interval_hull((A * A) * X0)) diff --git a/src/Continuous/exponentiation.jl b/src/Continuous/exponentiation.jl index c12976f20..c90822eab 100644 --- a/src/Continuous/exponentiation.jl +++ b/src/Continuous/exponentiation.jl @@ -20,7 +20,7 @@ using LinearAlgebra: checksquare @inline _exp(A::IdentityMultiple) = IdentityMultiple(exp(A.M.λ), size(A, 1)) """ - _exp(A::AbstractMatrix, δ::Float64, method::String) + _exp(A::AbstractMatrix, δ::Float64, method::Symbol) Compute the matrix exponential ``e^{Aδ}``. @@ -28,15 +28,15 @@ Compute the matrix exponential ``e^{Aδ}``. - `A` -- matrix - `δ` -- step size -- `method` -- the method used to take the matrix exponential of `A`; +- `method` -- symbol with the method used to take the matrix exponential of `A`; possible options are: - - `"base"` -- use the scaling and squaring method implemented in Julia standard - library; see `?exp` for details - - `"lazy"` -- return a lazy wrapper type around the matrix exponential using - the implementation `LazySets.SparseMatrixExp` - - `"pade"` -- apply Pade approximant method to compute the matrix exponential - of a sparse matrix (requires `Expokit`) + - `:base` -- use the scaling and squaring method implemented in Julia standard + library; see `?exp` for details + - `:lazy` -- return a lazy wrapper type around the matrix exponential using + the implementation `LazySets.SparseMatrixExp` + - `:pade` -- apply Pade approximant method to compute the matrix exponential + of a sparse matrix (requires `Expokit`) ### Output @@ -48,15 +48,15 @@ If the algorithm `"lazy"` is used, evaluations of the action of the matrix exponential are done with the `expmv` implementation from `Expokit` (but see `LazySets#1312` for the planned generalization to other backends). """ -function _exp(A::AbstractMatrix, δ::Float64, method::String) +function _exp(A::AbstractMatrix, δ::Float64, method::Symbol) n = checksquare(A) - if method == "base" + if method == :base return _exp(A * δ) # TODO use dots ? (requires MathematicalSystems#189 for IdentityMultiple) - elseif method == "lazy" + elseif method == :lazy return _exp_lazy(A * δ) - elseif method == "pade" + elseif method == :pade @requires Expokit return _exp_pade(A * δ) @@ -122,15 +122,15 @@ function Φ₁(A::AbstractMatrix, δ::Float64, method::String) n = checksquare(A) B = _Aδ_3n(A, δ, n) - if method == "base" + if method == :base P = _exp(B) return P[1:n, (n+1):2*n] - elseif method == "lazy" + elseif method == :lazy P = _exp_lazy(B) return sparse(get_columns(P, (n+1):2*n)[1:n, :]) - elseif method == "pade" + elseif method == :pade P = _exp_pade(B) return P[1:n, (n+1):2*n] @@ -185,23 +185,23 @@ It can be shown that `Φ₂(A, δ) = P[1:n, (2*n+1):3*n]`. International Conference on Computer Aided Verification. Springer, Berlin, Heidelberg, 2011. """ -function Φ₂(A::AbstractMatrix, δ::Float64, method::String) - if method == "inverse" +function Φ₂(A::AbstractMatrix, δ::Float64, method::Symbol) + if method == :inverse return _Φ₂_inverse(A, δ) end n = checksquare(A) B = _Aδ_3n(A, δ, n) - if method == "base" + if method == :base P = _exp(B) return P[1:n, (2*n+1):3*n] - elseif method == "lazy" + elseif method == :lazy P = _exp_lazy(B) return sparse(get_columns(P, (2*n+1):3*n)[1:n, :]) - elseif method == "pade" + elseif method == :pade P = _exp_pade(B) return P[1:n, (2*n+1):3*n]