-
-
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
Merged
Merged
eye speye deprecated methods #24356
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2076,6 +2076,55 @@ end | |
# deprecate bits to bitstring (#24263, #24281) | ||
@deprecate bits bitstring | ||
|
||
# deprecate speye | ||
export speye | ||
function speye(n::Integer) | ||
depwarn(string("`speye(n::Integer)` has been deprecated in favor of `I`, `sparse`, and ", | ||
"`SparseMatrixCSC` constructor methods. For a direct replacement, consider ", | ||
"`sparse(1.0I, n, n)`, `SparseMatrixCSC(1.0I, n, n)`, or `SparseMatrixCSC{Float64}(I, n, n)`. ", | ||
"If `Float64` element type is not necessary, consider the shorter `sparse(I, n, n)` ", | ||
"or `SparseMatrixCSC(I, n, n)` (with default `eltype(I)` of `Bool`)."), :speye) | ||
return sparse(1.0I, n, n) | ||
end | ||
function speye(m::Integer, n::Integer) | ||
depwarn(string("`speye(m::Integer, n::Integer)` has been deprecated in favor of `I`, ", | ||
"`sparse`, and `SparseMatrixCSC` constructor methods. For a direct ", | ||
"replacement, consider `sparse(1.0I, m, n)`, `SparseMatrixCSC(1.0I, m, n)`, ", | ||
"or `SparseMatrixCSC{Float64}(I, m, n)`. If `Float64` element type is not ", | ||
" necessary, consider the shorter `sparse(I, m, n)` or `SparseMatrixCSC(I, m, n)` ", | ||
"(with default `eltype(I)` of `Bool`)."), :speye) | ||
return sparse(1.0I, m, n) | ||
end | ||
function speye(::Type{T}, n::Integer) where T | ||
depwarn(string("`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`)."), :speye) | ||
return SparseMatrixCSC{T}(I, n) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 commentThe reason will be displayed to describe this comment to others. Learn more. Thanks |
||
end | ||
function speye(::Type{T}, m::Integer, n::Integer) where T | ||
depwarn(string("`speye(T, m::Integer, n::Integer)` has been deprecated in favor of `I`, ", | ||
"`sparse`, and `SparseMatrixCSC` constructor methods. For a direct ", | ||
"replacement, consider `sparse(T(1)I, m, n)` if `T` is concrete or ", | ||
"`SparseMatrixCSC{T}(I, m, n)` if `T` is either concrete or abstract. ", | ||
"If element type `T` is not necessary, consider the shorter ", | ||
"`sparse(I, m, n)` or `SparseMatrixCSC(I, m, n)` (with default `eltype(I)` ", | ||
"of `Bool`)."), :speye) | ||
return SparseMatrixCSC{T}(I, m, n) | ||
end | ||
function speye(S::SparseMatrixCSC{T}) where T | ||
depwarn(string("`speye(S::SparseMatrixCSC{T})` has been deprecated in favor of `I`, ", | ||
"`sparse`, and `SparseMatrixCSC` constructor methods. For a direct ", | ||
"replacement, consider `sparse(T(1)I, size(S)...)` if `T` is concrete or ", | ||
"`SparseMatrixCSC{eltype(S)}(I, size(S))` if `T` is either concrete or abstract. ", | ||
"If preserving element type `T` is not necessary, consider the shorter ", | ||
"`sparse(I, size(S)...)` or `SparseMatrixCSC(I, size(S))` (with default ", | ||
"`eltype(I)` of `Bool`)."), :speye) | ||
return SparseMatrixCSC{T}(I, m, n) | ||
end | ||
|
||
# issue #24167 | ||
@deprecate EnvHash EnvDict | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1255,7 +1255,6 @@ export | |
sparse, | ||
sparsevec, | ||
spdiagm, | ||
speye, | ||
spones, | ||
sprand, | ||
sprandn, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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! :)