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

hcat and vcat drop names when first argument is a number #135

Open
mzgubic opened this issue Sep 17, 2020 · 1 comment
Open

hcat and vcat drop names when first argument is a number #135

mzgubic opened this issue Sep 17, 2020 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mzgubic
Copy link
Collaborator

mzgubic commented Sep 17, 2020

When the first argument is a NamedDimsArray then all is well, but if the first argument is a number then names are dropped:

julia> ndv = NamedDimsArray(rand(2), (:x,));

julia> vcat(1, ndv)
3-element Array{Float64,1}:
 1.0
 0.03803080414772442
 0.24045992283044382

julia> hcat(1, ndv')
1×3 Array{Float64,2}:
 1.0  0.0380308  0.24046

Should work as:

julia> hcat(ndv', 1)
1×3 NamedDimsArray{(:_, :x),Float64,2,Array{Float64,2}}:
 0.0380308  0.24046  1.0

Thanks @mcabbott for bringing this up

@mzgubic mzgubic added bug Something isn't working good first issue Good for newcomers labels Sep 17, 2020
@mcabbott
Copy link
Collaborator

If you wanted to you could make all the hvcat methods work. For example, this should ideally be an error, but instead it has (almost) random names from a bug in similar:

julia> ndv = NamedDimsArray(rand(2), (:x,)); nda = NamedDimsArray(ones(2,2), (:y, :z));

julia> Float32[nda ndv
               ndv' 1]
3×3 NamedDimsArray{(:y, :z), Float32, 2, Matrix{Float32}}:
 1.0       1.0      0.398549
 1.0       1.0      0.88751
 0.398549  0.88751  1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants