Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcat of matrices should not be in SparseArrays.jl #28234

Closed
dlfivefifty opened this issue Jul 23, 2018 · 4 comments
Closed

vcat of matrices should not be in SparseArrays.jl #28234

dlfivefifty opened this issue Jul 23, 2018 · 4 comments

Comments

@dlfivefifty
Copy link
Contributor

This feels like type piracy:

julia> @which vcat(randn(2,10), randn(2,10))
vcat(A::Union{Array{T,1}, Array{T,2}, Adjoint{T,Array{T,1}}, RowVector{T,Array{T,1}}, Transpose{T,Array{T,1}}, LinearAlgebra.AbstractTriangular{T,A} where A<:(Array{T,2} where T), Hermitian{T,A} where A<:(Array{T,2} where T), Symmetric{T,A} where A<:(Array{T,2} where T)}...) where T in SparseArrays at /Users/solver/Projects/julia7/usr/share/julia/stdlib/v0.7/SparseArrays/src/sparsevector.jl:1068

julia> @which hcat(randn(2,10), randn(2,10))
hcat(A::Union{Array{T,1}, Array{T,2}, Adjoint{T,Array{T,1}}, RowVector{T,Array{T,1}}, Transpose{T,Array{T,1}}, LinearAlgebra.AbstractTriangular{T,A} where A<:(Array{T,2} where T), Hermitian{T,A} where A<:(Array{T,2} where T), Symmetric{T,A} where A<:(Array{T,2} where T)}...) where T in SparseArrays at /Users/solver/Projects/julia7/usr/share/julia/stdlib/v0.7/SparseArrays/src/sparsevector.jl:1069

Note that the special case of vector is in Base:

 julia> @which vcat(randn(10), randn(10))
vcat(arrays::Array{T,1}...) where T in Base at array.jl:1532
@KristofferC
Copy link
Member

type piracy

Well, rand(2,2) * rand(2)?

@dlfivefifty
Copy link
Contributor Author

Type piracy was not the right word... but it's a bit silly since the sparse array function immediately calls Base.typed_vcat. And why would vcat of vectors be in base but not vcat of matrices?

@Sacha0
Copy link
Member

Sacha0 commented Jul 23, 2018

The present code organization is an artifact of hacking around the lack of a proper concatenation promotion system; it should indeed change one day :). Best!

@StefanKarpinski StefanKarpinski added this to the 1.x milestone Jul 23, 2018
@oxinabox oxinabox mentioned this issue Feb 3, 2019
27 tasks
@laborg
Copy link
Contributor

laborg commented Feb 4, 2022

This has been fixed in #43127 :

julia> @which vcat(randn(2,10), randn(2,10))
vcat(A::Union{Vector{T}, Matrix{T}, LinearAlgebra.Adjoint{T, Vector{T}}, LinearAlgebra.Transpose{T, Vector{T}}, LinearAlgebra.AbstractTriangular{T, A} where A<:(Matrix), LinearAlgebra.Hermitian{T, A} where A<:(Matrix), LinearAlgebra.Symmetric{T, A} where A<:(Matrix)}...) where T in LinearAlgebra at /home/aigner/code/julia/usr/share/julia/stdlib/v1.8/LinearAlgebra/src/special.jl:376

julia> @which hcat(randn(2,10), randn(2,10))
hcat(A::Union{Vector{T}, Matrix{T}, LinearAlgebra.Adjoint{T, Vector{T}}, LinearAlgebra.Transpose{T, Vector{T}}, LinearAlgebra.AbstractTriangular{T, A} where A<:(Matrix), LinearAlgebra.Hermitian{T, A} where A<:(Matrix), LinearAlgebra.Symmetric{T, A} where A<:(Matrix)}...) where T in LinearAlgebra at /home/aigner/code/julia/usr/share/julia/stdlib/v1.8/LinearAlgebra/src/special.jl:377

@laborg laborg closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants