Skip to content

Commit

Permalink
add vec method for RowVector (#23701)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre authored Sep 15, 2017
1 parent ac714a1 commit 3477b88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/linalg/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Base: USE_BLAS64, abs, big, broadcast, ceil, conj, convert, copy, copy!,
adjoint, eltype, exp, eye, findmax, findmin, fill!, floor, full, getindex,
hcat, imag, indices, inv, isapprox, isone, IndexStyle, kron, length, log, map,
ndims, oneunit, parent, power_by_squaring, print_matrix, promote_rule, real, round,
setindex!, show, similar, size, sqrt, transpose, trunc, typed_hcat
setindex!, show, similar, size, sqrt, transpose, trunc, typed_hcat, vec
using Base: hvcat_fill, iszero, IndexLinear, _length, promote_op, promote_typeof,
@propagate_inbounds, @pure, reduce, typed_vcat
# We use `_length` because of non-1 indices; releases after julia 0.5
Expand Down
1 change: 1 addition & 0 deletions base/linalg/rowvector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ julia> transpose(v)
@inline adjoint(rowvec::RowVector{<:Real}) = rowvec.vec

parent(rowvec::RowVector) = rowvec.vec
vec(rowvec::RowVector) = rowvec.vec

"""
conj(v::RowVector)
Expand Down
3 changes: 3 additions & 0 deletions test/linalg/rowvector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@

y = rand(Complex{Float64},3)
@test sum(abs2, imag.(diag(y .+ y'))) < 1e-20

@test parent(rv) === v
@test vec(rv) === v
end

@testset "Diagonal ambiguity methods" begin
Expand Down

0 comments on commit 3477b88

Please sign in to comment.