@@ -1792,7 +1792,53 @@ end
17921792 @deprecate get_creds! (cache:: CachedCredentials , credid, default) get! (cache, credid, default)
17931793end
17941794
1795- @deprecate eye (:: Type{Diagonal{T}} , n:: Int ) where {T} Diagonal {T} (I, n)
1795+ # # goodbeye, eye!
1796+ export eye
1797+ function eye (m:: Integer )
1798+ depwarn (string (" `eye(m::Integer)` has been deprecated in favor of `I` and `Matrix` " ,
1799+ " constructors. For a direct replacement, consider `Matrix(1.0I, m, m)` or " ,
1800+ " `Matrix{Float64}(I, m, m)`. If `Float64` element type is not necessary, " ,
1801+ " consider the shorter `Matrix(I, m, m)` (with default `eltype(I)` `Bool`)." ), :eye )
1802+ return Matrix {Float64} (I, m, m)
1803+ end
1804+ function eye (:: Type{T} , m:: Integer ) where T
1805+ depwarn (string (" `eye(T::Type, m::Integer)` has been deprecated in favor of `I` and " ,
1806+ " `Matrix` constructors. For a direct replacement, consider `Matrix{T}(I, m, m)`. If " ,
1807+ " `T` element type is not necessary, consider the shorter `Matrix(I, m, m)`" ,
1808+ " (with default `eltype(I)` `Bool`)" ), :eye )
1809+ return Matrix {T} (I, m, m)
1810+ end
1811+ function eye (m:: Integer , n:: Integer )
1812+ depwarn (string (" `eye(m::Integer, n::Integer)` has been deprecated in favor of `I` and " ,
1813+ " `Matrix` constructors. For a direct replacement, consider `Matrix(1.0I, m, n)` " ,
1814+ " or `Matrix{Float64}(I, m, n)`. If `Float64` element type is not necessary, " ,
1815+ " consider the shorter `Matrix(I, m, n)` (with default `eltype(I)` `Bool`)." ), :eye )
1816+ return Matrix {Float64} (I, m, n)
1817+ end
1818+ function eye (:: Type{T} , m:: Integer , n:: Integer ) where T
1819+ depwarn (string (" `eye(T::Type, m::Integer, n::Integer)` has been deprecated in favor of " ,
1820+ " `I` and `Matrix` constructors. For a direct replacement, consider `Matrix{T}(I, m, n)`." ,
1821+ " If `T` element type is not necessary, consider the shorter `Matrix(I, m, n)` " ,
1822+ " (with default `eltype(I)` `Bool`)." ), :eye )
1823+ return Matrix {T} (I, m, n)
1824+ end
1825+ function eye (A:: AbstractMatrix{T} ) where T
1826+ depwarn (string (" `eye(A::AbstractMatrix{T})` has been deprecated in favor of `I` and " ,
1827+ " `Matrix` constructors. For a direct replacement, consider `Matrix{eltype(A)}(I, size(A))`." ,
1828+ " If `eltype(A)` element type is not necessary, consider the shorter `Matrix(I, size(A))` " ,
1829+ " (with default `eltype(I)` `Bool`)." ), :eye )
1830+ return Matrix (one (T)I, size (A))
1831+ end
1832+ function eye (:: Type{Diagonal{T}} , n:: Int ) where T
1833+ depwarn (string (" `eye(DT::Type{Diagonal{T}}, n::Int)` has been deprecated in favor of `I` " ,
1834+ " and `Diagonal` constructors. For a direct replacement, consider `Diagonal{T}(I, n)`. " ,
1835+ " If `T` element type is not necessary, consider the shorter `Diagonal(I, n)` " ,
1836+ " (with default `eltype(I)` `Bool`)." ), :eye )
1837+ return Diagonal {T} (I, n)
1838+ end
1839+ @eval Base. LinAlg import Base. eye
1840+ # @eval Base.SparseArrays import Base.eye # SparseArrays has an eye for things cholmod
1841+
17961842
17971843export tic, toq, toc
17981844function tic ()
@@ -1986,8 +2032,8 @@ function full(Q::LinAlg.LQPackedQ; thin::Bool = true)
19862032 " `full(Q::LQPackedQ; thin::Bool = true)` (and `full` in general) " ,
19872033 " has been deprecated. To replace `full(Q::LQPackedQ, true)`, " ,
19882034 " consider `Matrix(Q)` or `Array(Q)`. To replace `full(Q::LQPackedQ, false)`, " ,
1989- " consider `Base.LinAlg.A_mul_B!(Q, eye( eltype(Q), size(Q.factors, 2)))`." ), :full )
1990- return thin ? Array (Q) : A_mul_B! (Q, eye ( eltype (Q), size (Q. factors, 2 )))
2035+ " consider `Base.LinAlg.A_mul_B!(Q, Matrix{ eltype(Q)}(I, size(Q.factors, 2 ), size(Q.factors, 2)))`." ), :full )
2036+ return thin ? Array (Q) : A_mul_B! (Q, Matrix { eltype(Q)} (I, size (Q . factors, 2 ), size (Q. factors, 2 )))
19912037end
19922038function full (Q:: Union{LinAlg.QRPackedQ,LinAlg.QRCompactWYQ} ; thin:: Bool = true )
19932039 qtypestr = isa (Q, LinAlg. QRPackedQ) ? " QRPackedQ" :
@@ -1997,8 +2043,8 @@ function full(Q::Union{LinAlg.QRPackedQ,LinAlg.QRCompactWYQ}; thin::Bool = true)
19972043 " `full(Q::$(qtypestr) ; thin::Bool = true)` (and `full` in general) " ,
19982044 " has been deprecated. To replace `full(Q::$(qtypestr) , true)`, " ,
19992045 " consider `Matrix(Q)` or `Array(Q)`. To replace `full(Q::$(qtypestr) , false)`, " ,
2000- " consider `Base.LinAlg.A_mul_B!(Q, eye( eltype(Q), size(Q.factors, 1)))`." ), :full )
2001- return thin ? Array (Q) : A_mul_B! (Q, eye ( eltype (Q), size (Q. factors, 1 )))
2046+ " consider `Base.LinAlg.A_mul_B!(Q, Matrix{ eltype(Q)}(I, size(Q.factors, 1 ), size(Q.factors, 1)))`." ), :full )
2047+ return thin ? Array (Q) : A_mul_B! (Q, Matrix { eltype(Q)} (I, size (Q . factors, 1 ), size (Q. factors, 1 )))
20022048end
20032049
20042050# full for symmetric / hermitian / triangular wrappers
0 commit comments