Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ julia> ℯ^[1 2; 0 3]
0.0 20.0855
```
"""
Base.:^(b::Number, A::AbstractMatrix) = exp!(log(b)*A)
Base.:^(b::Number, A::AbstractMatrix) = exp_maybe_inplace(log(b)*A)
# method for ℯ to explicitly elide the log(b) multiplication
Base.:^(::Irrational{:ℯ}, A::AbstractMatrix) = exp(A)

Expand Down
8 changes: 8 additions & 0 deletions test/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
isdefined(Main, :FillArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "FillArrays.jl"))
import Main.FillArrays

isdefined(Main, :SizedArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "SizedArrays.jl"))
using Main.SizedArrays

@testset "Check that non-floats are correctly promoted" begin
@test [1 0 0; 0 1 0]\[1,1] ≈ [1;1;0]
end
Expand Down Expand Up @@ -1398,4 +1401,9 @@ end
@test_throws ArgumentError LinearAlgebra.copytri_maybe_inplace(Rc, 'X')
end

@testset "matrix exponentiation for immutable" begin
A = SizedArray{(2,2)}(reshape(1:4,2,2))
@test 2^A == 2^Matrix(A)
end

end # module TestDense