Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions stdlib/LinearAlgebra/src/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ rdiv!(A, B)
copy_oftype(A::AbstractArray{T}, ::Type{T}) where {T} = copy(A)
copy_oftype(A::AbstractArray{T,N}, ::Type{S}) where {T,N,S} = convert(AbstractArray{S,N}, A)

# matrix exponentials for ℯ
Base.:^(::Irrational{:ℯ}, A::AbstractMatrix) = exp(A)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this just below

exp(A::StridedMatrix{<:Union{Integer,Complex{<:Integer}}}) = exp!(float.(A))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure about that? the reason I didn't put it in there is because it is only for dense, it could work for sparse array types as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it doesn't, this is the generic exp so I would put it here.


include("adjtrans.jl")
include("transpose.jl")

Expand Down
4 changes: 4 additions & 0 deletions stdlib/LinearAlgebra/test/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,10 @@ end
[4.000000000000000 -1.414213562373094 -1.414213562373095
-1.414213562373095 4.999999999999996 -0.000000000000000
0 -0.000000000000002 3.000000000000000])

# alias using ℯ, should be exact
@test ℯ^(fill(2, (4,4))) == exp(fill(2, (4,4)))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also move these test out the loop over the elty, maybe to a separate sub-testset.

@test ℯ^(fill(2.4, (4,4))) == exp(fill(2.4, (4,4)))
end

@testset "Additional tests for $elty" for elty in (Float64, Complex{Float64})
Expand Down