Skip to content

Commit

Permalink
Add Matrix(I, dims) constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan authored and fredrikekre committed Jan 22, 2018
1 parent a342f94 commit 9ff27f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,10 @@ end
export parentmodule
end

@static if VERSION < v"0.7.0-DEV.2541"
(::Type{Matrix}){T}(I::UniformScaling{T}, dims...) = eye(T, dims...)
end

include("deprecated.jl")

end # module Compat
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,10 @@ end
# 0.7.0-DEV.3415
@test findall(x -> x==1, [1, 2, 3, 2, 1]) == [1, 5]

# 0.7.0-DEV.2541
@test Matrix(I, 2, 2) == [1 0; 0 1]
@test eltype(Matrix(1.0I, 3, 3)) == Float64

if VERSION < v"0.6.0"
include("deprecated.jl")
end
Expand Down

0 comments on commit 9ff27f3

Please sign in to comment.