-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
eye speye deprecated methods #24356
eye speye deprecated methods #24356
Conversation
base/deprecated.jl
Outdated
# deprecate speye | ||
@deprecate speye(n::Integer) sparse(1.0I, n) | ||
@deprecate speye(m::Integer, n::Integer) sparse(1.0I, m, n) | ||
@deprecate speye(::Type{T}, n::Integer) where {T} = sparse(UniformScaling{T}(one(T)), n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misplaced =
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Fixed. Thanks Alex! :)
As @fredrikekre prompted in #23156 (comment) / #23156 (comment) , we might consider simultaneously deprecating |
2ea21f4
to
5005854
Compare
Fixed a few mistakes, added news, and removed the WIP label. Downstream actions include introducing a |
I think |
70d29c6
to
db88a73
Compare
@@ -2062,6 +2062,57 @@ end | |||
# deprecate bits to bitstring (#24263, #24281) | |||
@deprecate bits bitstring | |||
|
|||
# deprecate speye |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should export speye
to avoid #24325 again :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! One day I will remember :). Also fixed. Thanks! :)
base/deprecated.jl
Outdated
"`sparse(1.0I, n)`, `SparseMatrixCSC(1.0I, n)`, or `SparseMatrixCSC{Float64}(I, n)`. ", | ||
"If `Float64` element type is not necessary, consider the shorter `sparse(I, n)` ", | ||
"or `SparseMatrixCSC(I, n)` (with default `eltype(I)` of `Bool`)."), :speye) | ||
return speye(1.0I, n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sparse(1.0I, n))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Fixed on push. Thanks!
Plan per triage: Remove the single-integer versions of |
Revised in accord with triage, removing the single-integer versions of |
Ref. #24438 (comment). Best! |
Rebased. Absent objections or requests for time, I plan to merge this pull request tomorrow. Best! |
Thanks all! :) |
"if `T` is either concrete or abstract. If element type `T` is not necessary, ", | ||
"consider the shorter `sparse(I, n, n)` or `SparseMatrixCSC(I, n, n)` ", | ||
"(with default `eltype(I)` of `Bool`)."), :speye) | ||
return SparseMatrixCSC{T}(I, n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SparseMatrixCSC{T}(I, n, n)
Currently,
julia> speye(Float64, 4)
WARNING: `speye(T, n::Integer)` has been deprecated in favor of `I`, `sparse`, and `SparseMatrixCSC` constructor methods. For a direct replacement, consider `sparse(T(1)I, n, n)` if `T` is concrete or `SparseMatrixCSC{T}(I, n, n)` if `T` is either concrete or abstract. If element type `T` is not necessary, consider the shorter `sparse(I, n, n)` or `SparseMatrixCSC(I, n, n)` (with default `eltype(I)` of `Bool`).
Stacktrace:
[1] depwarn(::String, ::Symbol) at ./deprecated.jl:68
[2] speye(::Type{Float64}, ::Int64) at ./deprecated.jl:2145
[3] top-level scope
[4] eval(::Module, ::Expr) at ./repl/REPL.jl:3
[5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./repl/REPL.jl:69
[6] macro expansion at ./repl/REPL.jl:100 [inlined]
[7] (::getfield(Base.REPL, Symbol("##1#2")){Base.REPL.REPLBackend})() at ./event.jl:95
in expression starting at no file:0
ERROR: MethodError: no method matching SparseMatrixCSC{Float64,Ti} where Ti<:Integer(::UniformScaling{Bool}, ::Int64)
Stacktrace:
[1] speye(::Type{Float64}, ::Int64) at ./deprecated.jl:2151
[2] top-level scope
EDIT: Fix at #24663.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @martinholters
! :)
Towards #23156 (comment), this pull request explores deprecating
speye
. Please see observations from sketching this pull request in #23156 (comment). Best!