Skip to content

Commit 8e15aa4

Browse files
committed
Deprecate RowVector{T}(shape...) constructors to RowVector{T}(uninitialized, shape...) equivalents.
1 parent f2c9ccf commit 8e15aa4

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

NEWS.md

+7
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,13 @@ Deprecated or removed
427427
* `whos` has been renamed `varinfo`, and now returns a markdown table instead of printing
428428
output ([#12131]).
429429

430+
* Uninitialized `RowVector` constructors of the form `RowVector{T}(shape...)` have been
431+
deprecated in favor of equivalents accepting `uninitialized` (an alias for
432+
`Uninitialized()`) as their first argument, as in
433+
`RowVector{T}(uninitialized, shape...)`. For example, `RowVector{Int}(3)` is now
434+
`RowVector{Int}(uninitialized, 3)`, and `RowVector{Float32}((1, 4))` is now
435+
`RowVector{Float32}(uninitialized, (1, 4))` ([#24786]).
436+
430437
* `writecsv(io, a; opts...)` has been deprecated in favor of
431438
`writedlm(io, a, ','; opts...)` ([#23529]).
432439

base/deprecated.jl

+6
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,12 @@ end
21092109
@deprecate chol!(x::Number, uplo) chol(x) false
21102110
end
21112111

2112+
# deprecate RowVector{T}(shape...) constructors to RowVector{T}(uninitialized, shape...) equivalents
2113+
@deprecate RowVector{T}(n::Int) where {T} RowVector{T}(uninitialized, n)
2114+
@deprecate RowVector{T}(n1::Int, n2::Int) where {T} RowVector{T}(uninitialized, n1, n2)
2115+
@deprecate RowVector{T}(n::Tuple{Int}) where {T} RowVector{T}(uninitializd, n)
2116+
@deprecate RowVector{T}(n::Tuple{Int,Int}) where {T} RowVector{T}(uninitialized, n)
2117+
21122118
@deprecate cumsum(A::AbstractArray) cumsum(A, 1)
21132119
@deprecate cumsum_kbn(A::AbstractArray) cumsum_kbn(A, 1)
21142120
@deprecate cumprod(A::AbstractArray) cumprod(A, 1)

base/linalg/rowvector.jl

-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,6 @@ const ConjRowVector{T,CV<:ConjVector} = RowVector{T,CV}
4545
@inline RowVector{T}(::Uninitialized, n::Tuple{Int,Int}) where {T} =
4646
n[1] == 1 ? RowVector{T}(Vector{transpose_type(T)}(uninitialized, n[2])) :
4747
error("RowVector expects 1×N size, got $n")
48-
# to deprecate, RowVector{T}(shape...) constructors
49-
@inline RowVector{T}(n::Int) where {T} = RowVector{T}(uninitialized, n)
50-
@inline RowVector{T}(n1::Int, n2::Int) where {T} = RowVector{T}(uninitialized, n1, n2)
51-
@inline RowVector{T}(n::Tuple{Int}) where {T} = RowVector{T}(uninitializd, n)
52-
@inline RowVector{T}(n::Tuple{Int,Int}) where {T} = RowVector{T}(uninitialized, n)
5348

5449
# Conversion of underlying storage
5550
convert(::Type{RowVector{T,V}}, rowvec::RowVector) where {T,V<:AbstractVector} =

0 commit comments

Comments
 (0)