From 5829bba2d97e57b673ab2af0786422bb41628074 Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Mon, 30 Oct 2017 16:33:28 -0700 Subject: [PATCH] Deprecate eye(::Type{Diagonal{T}}, m::Integer) method. --- base/deprecated.jl | 2 ++ base/linalg/diagonal.jl | 2 -- test/linalg/diagonal.jl | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/base/deprecated.jl b/base/deprecated.jl index 9927285ba7d26..92e7df4de6ef1 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1793,6 +1793,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) diff --git a/base/linalg/diagonal.jl b/base/linalg/diagonal.jl index 6275952a70cb2..13683b71de936 100644 --- a/base/linalg/diagonal.jl +++ b/base/linalg/diagonal.jl @@ -345,8 +345,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, diff --git a/test/linalg/diagonal.jl b/test/linalg/diagonal.jl index 1975686bc1248..c74092041e32d 100644 --- a/test/linalg/diagonal.jl +++ b/test/linalg/diagonal.jl @@ -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}