Skip to content

Commit cc0c3d0

Browse files
committed
Deprecate no-op transpose fallback instead of error'ing.
1 parent 3f08daf commit cc0c3d0

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

NEWS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ Deprecated or removed
237237

238238
* `sub` and `slice` have been deprecated in favor of `view` ([#16972])
239239

240+
* The no-op `transpose` fallback has been deprecated. Consider introducing suitable
241+
`transpose` methods or calling `permutedims(x, [2,1])` ([#13171], [#17075], [#17374]).
242+
240243
[PkgDev]: https://github.com/JuliaLang/PkgDev.jl
241244
<!--- generated by NEWS-update.jl: -->
242245
[#1090]: https://github.com/JuliaLang/julia/issues/1090
@@ -251,6 +254,7 @@ Deprecated or removed
251254
[#11196]: https://github.com/JuliaLang/julia/issues/11196
252255
[#11242]: https://github.com/JuliaLang/julia/issues/11242
253256
[#13062]: https://github.com/JuliaLang/julia/issues/13062
257+
[#13171]: https://github.com/JuliaLang/julia/issues/13171
254258
[#13232]: https://github.com/JuliaLang/julia/issues/13232
255259
[#13338]: https://github.com/JuliaLang/julia/issues/13338
256260
[#13387]: https://github.com/JuliaLang/julia/issues/13387
@@ -299,5 +303,7 @@ Deprecated or removed
299303
[#16645]: https://github.com/JuliaLang/julia/issues/16645
300304
[#16731]: https://github.com/JuliaLang/julia/issues/16731
301305
[#16972]: https://github.com/JuliaLang/julia/issues/16972
302-
[#17266]: https://github.com/JuliaLang/julia/issues/17266
303306
[#17037]: https://github.com/JuliaLang/julia/issues/17037
307+
[#17075]: https://github.com/JuliaLang/julia/issues/17075
308+
[#17266]: https://github.com/JuliaLang/julia/issues/17266
309+
[#17374]: https://github.com/JuliaLang/julia/issues/17374

base/deprecated.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,15 @@ function symperm{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, pinv::Vector{Ti})
784784
"Pkg.add(\"SuiteSparse\") to install SuiteSparse on Julia v0.5."))
785785
end
786786

787+
# Deprecate no-op transpose fallback. Please see #13171 and #17075.
788+
function transpose(x)
789+
depwarn(string("the no-op `transpose` fallback is deprecated, and no more specific ",
790+
"`transpose` method for $(typeof(x)) exists. Consider `permutedims(x, [2, 1])` ",
791+
"or writing a specific `transpose(x::$(typeof(x)))` method if appropriate."),
792+
:transpose)
793+
return x
794+
end
795+
787796
# During the 0.5 development cycle, do not add any deprecations below this line
788797
# To be deprecated in 0.6
789798

base/operators.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ fldmod1{T<:Real}(x::T, y::T) = (fld1(x,y), mod1(x,y))
293293
fldmod1{T<:Integer}(x::T, y::T) = (fld1(x,y), mod1(x,y))
294294

295295
# transpose
296-
transpose(x) = throw(ArgumentError("transpose not implemented for $(typeof(x)). Consider permutedims."))
297296
ctranspose(x) = conj(transpose(x))
298297
conj(x) = x
299298

0 commit comments

Comments
 (0)