FixedSizeArrays.jl icon indicating copy to clipboard operation
FixedSizeArrays.jl copied to clipboard

hcat and vcat don't behave like arrays

Open stevengj opened this issue 9 years ago • 7 comments

julia> hcat(Vec(3,4),Vec(5,6))
1×2 Array{FixedSizeArrays.Vec{2,Int64},2}:
 Vec(3,4)  Vec(5,6)

julia> vcat(Vec(3,4),Vec(5,6))
2-element Array{FixedSizeArrays.Vec{2,Int64},1}:
 Vec(3,4)
 Vec(5,6)

I was expecting that Vec would behave like an Array here, i.e. that hcat would produce a Mat{2,2} and vcat would produce a Vec{4}.

stevengj avatar Nov 01 '16 01:11 stevengj

@stevengj Not sure if you saw #159? I realize there are good reasons for using FIxedSizeArrays (including backward compatibility, integration into other packages, etc), and don't want to steal thunder from @SimonDanisch for this awesome package, but I wanted to mention that the issues you raised today are not present in StaticArrays.jl.

andyferris avatar Nov 01 '16 02:11 andyferris

@andyferris, thanks for the tip. I have to admit that the variety of packages for fixed-size arrays (FixedSizeArrays, ImmutableArrays, StaticArrays) confuses me, and I was unclear on which one I should use. I'll take a look at StaticArrays.

stevengj avatar Nov 01 '16 02:11 stevengj

No worries. There was a suggestion to add note to the READMEs of these packages which might help with this.

andyferris avatar Nov 01 '16 03:11 andyferris

Sorry about this, that's my fault. I just don't feel comfortable about spreading the deprecation of FixedSizeArrays before I haven't actually moved away my own packages! Lets get this done this week and have an announcement on the user list etc!

SimonDanisch avatar Nov 01 '16 09:11 SimonDanisch

Lets get this done this week and have an announcement on the user list etc!

Sounds good. :smiley: I'm currently making a few architectural changes to StaticArrays and will tag a new minor release when that is in reasonable shape (a couple of days) so we can time it with that.

On a related note, how are you finding using StaticArrays for geometry? Did you get a Point type working the way you like?

andyferris avatar Nov 01 '16 10:11 andyferris

I don't actually care much about the distinction between Point and Vec in my application (I don't need to dispatch on the difference, anyway), so I'm not planning defining a Point type. If I have any problems with StaticArrays, you'll notice me filing a slew of issues. 😄

stevengj avatar Nov 01 '16 11:11 stevengj

you'll notice me filing a slew of issues

I look forward to it! :smile:

andyferris avatar Nov 01 '16 21:11 andyferris