From 5fe89c0f9ff2919f05e3ef2147e6c3cd8a325b7e Mon Sep 17 00:00:00 2001 From: Kevin Constantineau <146906008+BaronNashville@users.noreply.github.com> Date: Thu, 12 Mar 2026 10:02:01 -0400 Subject: [PATCH] Improved matrix exponential for real matrices --- ext/IntervalArithmeticLinearAlgebraExt.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/IntervalArithmeticLinearAlgebraExt.jl b/ext/IntervalArithmeticLinearAlgebraExt.jl index 32a7d25a..954bc5c9 100644 --- a/ext/IntervalArithmeticLinearAlgebraExt.jl +++ b/ext/IntervalArithmeticLinearAlgebraExt.jl @@ -203,11 +203,15 @@ end # matrix exponential and logarithm -function LinearAlgebra.exp!(A::AbstractMatrix{<:RealOrComplexI}) +function LinearAlgebra.exp!(A::AbstractMatrix{T}) where T<:RealOrComplexI # note: this function does not overwrite `A` Λ, V = LinearAlgebra.eigen(A) V⁻¹ = inv(V) - return V * LinearAlgebra.Diagonal(exp.(Λ)) * V⁻¹ + if T <: Real + return real(V * LinearAlgebra.Diagonal(exp.(Λ)) * V⁻¹) + else + return V * LinearAlgebra.Diagonal(exp.(Λ)) * V⁻¹ + end end function LinearAlgebra.log(A::AbstractMatrix{<:Interval})