Skip to content

Commit 90aea4a

Browse files
committed
Replace primitive RowVector{T}(shape...) constructors with RowVector{T}(uninitialized, shape...) etc.
1 parent f383276 commit 90aea4a

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

base/linalg/rowvector.jl

+15-8
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,21 @@ const ConjRowVector{T,CV<:ConjVector} = RowVector{T,CV}
3535
@inline RowVector{T}(vec::AbstractVector{T}) where {T} = RowVector{T,typeof(vec)}(vec)
3636

3737
# Constructors that take a size and default to Array
38-
@inline RowVector{T}(n::Int) where {T} = RowVector{T}(Vector{transpose_type(T)}(uninitialized, n))
39-
@inline RowVector{T}(n1::Int, n2::Int) where {T} = n1 == 1 ?
40-
RowVector{T}(Vector{transpose_type(T)}(uninitialized, n2)) :
41-
error("RowVector expects 1×N size, got ($n1,$n2)")
42-
@inline RowVector{T}(n::Tuple{Int}) where {T} = RowVector{T}(Vector{transpose_type(T)}(uninitialized, n[1]))
43-
@inline RowVector{T}(n::Tuple{Int,Int}) where {T} = n[1] == 1 ?
44-
RowVector{T}(Vector{transpose_type(T)}(uninitialized, n[2])) :
45-
error("RowVector expects 1×N size, got $n")
38+
@inline RowVector{T}(::Uninitialized, n::Int) where {T} =
39+
RowVector{T}(Vector{transpose_type(T)}(uninitialized, n))
40+
@inline RowVector{T}(::Uninitialized, n1::Int, n2::Int) where {T} =
41+
n1 == 1 ? RowVector{T}(Vector{transpose_type(T)}(uninitialized, n2)) :
42+
error("RowVector expects 1×N size, got ($n1,$n2)")
43+
@inline RowVector{T}(::Uninitialized, n::Tuple{Int}) where {T} =
44+
RowVector{T}(Vector{transpose_type(T)}(uninitialized, n[1]))
45+
@inline RowVector{T}(::Uninitialized, n::Tuple{Int,Int}) where {T} =
46+
n[1] == 1 ? RowVector{T}(Vector{transpose_type(T)}(uninitialized, n[2])) :
47+
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)
4653

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

0 commit comments

Comments
 (0)