diff --git a/base/abstractarraymath.jl b/base/abstractarraymath.jl index ee208780fffa2..2f6b5885b5fa5 100644 --- a/base/abstractarraymath.jl +++ b/base/abstractarraymath.jl @@ -37,6 +37,7 @@ See also [`reshape`](@ref). """ vec(a::AbstractArray) = reshape(a,_length(a)) vec(a::AbstractVector) = a +vec(a::RowVector) = a.vec _sub(::Tuple{}, ::Tuple{}) = () _sub(t::Tuple, ::Tuple{}) = t diff --git a/base/linalg/dense.jl b/base/linalg/dense.jl index 8b75edbef4686..6e7ae2b9e4b0a 100644 --- a/base/linalg/dense.jl +++ b/base/linalg/dense.jl @@ -306,7 +306,7 @@ julia> diag(A,1) 6 ``` """ -diag(A::AbstractMatrix, k::Integer=0) = A[diagind(A,k)] +diag(A::AbstractMatrix, k::Integer=0) = vec(A[diagind(A,k)]) """ diagm(kv::Pair{<:Integer,<:AbstractVector}...)