Skip to content

Commit

Permalink
Deprecate eye(::Type{Diagonal{T}}, m::Integer) method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sacha0 committed Oct 31, 2017
1 parent e05b794 commit 5b1e48f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ Library improvements

* The `crc32c` function for CRC-32c checksums is now exported ([#22274]).

* `eye(::Type{Diagonal{T}}, m::Integer)` has been deprecated in favor of
`Diagonal{T}(I, m)` ([#24413]).

* The output of `versioninfo` is now controlled with keyword arguments ([#21974]).

* The function `LibGit2.set_remote_url` now always sets both the fetch and push URLs for a
Expand Down
2 changes: 2 additions & 0 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,8 @@ end
@deprecate get_creds!(cache::CachedCredentials, credid, default) get!(cache, credid, default)
end

@deprecate eye(::Type{Diagonal{T}}, n::Int) where {T} Diagonal{T}(I, n)

export tic, toq, toc
function tic()
depwarn("tic() is deprecated, use @time, @elapsed, or calls to time_ns() instead.", :tic)
Expand Down
2 changes: 0 additions & 2 deletions base/linalg/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ function logdet(D::Diagonal{<:Complex}) # make sure branch cut is correct
z = sum(log, D.diag)
complex(real(z), rem2pi(imag(z), RoundNearest))
end
# identity matrices via eye(Diagonal{type},n)
eye(::Type{Diagonal{T}}, n::Int) where {T} = Diagonal(ones(T,n))

# Matrix functions
for f in (:exp, :log, :sqrt,
Expand Down
2 changes: 1 addition & 1 deletion base/linalg/uniformscaling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -374,4 +374,4 @@ chol(J::UniformScaling, args...) = ((C, info) = _chol!(J, nothing); @assertposde

## Diagonal construction from UniformScaling
Diagonal{T}(s::UniformScaling, m::Integer) where {T} = Diagonal{T}(fill(T(s.λ), m))
Diagonal(s::UniformScaling, m::Integer) where {T} = Diagonal{eltype(s)}(s, m)
Diagonal(s::UniformScaling, m::Integer) = Diagonal{eltype(s)}(s, m)
1 change: 0 additions & 1 deletion test/linalg/diagonal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ srand(1)
end

@testset "Basic properties" begin
@test eye(Diagonal{elty},n) == Diagonal(ones(elty,n))
@test_throws ArgumentError size(D,0)
@test typeof(convert(Diagonal{Complex64},D)) <: Diagonal{Complex64}
@test typeof(convert(AbstractMatrix{Complex64},D)) <: Diagonal{Complex64}
Expand Down

0 comments on commit 5b1e48f

Please sign in to comment.