Skip to content

Commit 7545b18

Browse files
jishnublazarusA
authored andcommitted
LinearAlgebra: remove internal function _makevector (JuliaLang#55345)
It seems a bit unnecessary to have a function to carry out a `convert`, instead of calling `convert` directly.
1 parent 2649772 commit 7545b18

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

stdlib/LinearAlgebra/src/LinearAlgebra.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,10 +655,6 @@ _evview(S::SymTridiagonal) = @view S.ev[begin:begin + length(S.dv) - 2]
655655
_zeros(::Type{T}, b::AbstractVector, n::Integer) where {T} = zeros(T, max(length(b), n))
656656
_zeros(::Type{T}, B::AbstractMatrix, n::Integer) where {T} = zeros(T, max(size(B, 1), n), size(B, 2))
657657

658-
# convert to Vector, if necessary
659-
_makevector(x::Vector) = x
660-
_makevector(x::AbstractVector) = Vector(x)
661-
662658
# append a zero element / drop the last element
663659
_pushzero(A) = (B = similar(A, length(A)+1); @inbounds B[begin:end-1] .= A; @inbounds B[end] = zero(eltype(B)); B)
664660
_droplast!(A) = deleteat!(A, lastindex(A))

stdlib/LinearAlgebra/src/bidiag.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@ tr(B::Bidiagonal) = sum(B.dv)
252252

253253
function kron(A::Diagonal, B::Bidiagonal)
254254
# `_droplast!` is only guaranteed to work with `Vector`
255-
kdv = _makevector(kron(diag(A), B.dv))
256-
kev = _droplast!(_makevector(kron(diag(A), _pushzero(B.ev))))
255+
kdv = convert(Vector, kron(diag(A), B.dv))
256+
kev = _droplast!(convert(Vector, kron(diag(A), _pushzero(B.ev))))
257257
Bidiagonal(kdv, kev, B.uplo)
258258
end
259259

stdlib/LinearAlgebra/src/diagonal.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,9 @@ function kron(A::Diagonal, B::SymTridiagonal)
684684
end
685685
function kron(A::Diagonal, B::Tridiagonal)
686686
# `_droplast!` is only guaranteed to work with `Vector`
687-
kd = _makevector(kron(diag(A), B.d))
688-
kdl = _droplast!(_makevector(kron(diag(A), _pushzero(B.dl))))
689-
kdu = _droplast!(_makevector(kron(diag(A), _pushzero(B.du))))
687+
kd = convert(Vector, kron(diag(A), B.d))
688+
kdl = _droplast!(convert(Vector, kron(diag(A), _pushzero(B.dl))))
689+
kdu = _droplast!(convert(Vector, kron(diag(A), _pushzero(B.du))))
690690
Tridiagonal(kdl, kd, kdu)
691691
end
692692

0 commit comments

Comments
 (0)