Skip to content

Commit

Permalink
diag check in in-place exp
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Nov 9, 2024
1 parent 5363412 commit 5f2d382
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stdlib/LinearAlgebra/src/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,12 @@ Base.:^(::Irrational{:ℯ}, A::AbstractMatrix) = exp(A)
## "Functions of Matrices: Theory and Computation", SIAM
function exp!(A::StridedMatrix{T}) where T<:BlasFloat
n = checksquare(A)
if ishermitian(A)
if isdiag(A)
for i in diagind(A, IndexStyle(A))
A[i] = exp(A[i])
end
return A
elseif ishermitian(A)
return copytri!(parent(exp(Hermitian(A))), 'U', true)
end
ilo, ihi, scale = LAPACK.gebal!('B', A) # modifies A
Expand Down

0 comments on commit 5f2d382

Please sign in to comment.