Skip to content

Commit 96c8bbe

Browse files
committed
Address comments.
1 parent dde2732 commit 96c8bbe

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

src/linalg.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ end
8989
end
9090

9191
@inline vcat(a::StaticVecOrMat) = a
92-
@inline vcat(a::Union{StaticVector, StaticMatrix}, b::StaticVecOrMat) = _vcat(Size(a), Size(b), a, b)
93-
@inline vcat(a::StaticVecOrMat, b::StaticVecOrMat, c::StaticVecOrMat...) =
94-
vcat(vcat(a,b), vcat(c...))
92+
@inline vcat(a::StaticVecOrMat, b::StaticVecOrMat) = _vcat(Size(a), Size(b), a, b)
93+
@inline vcat(a::StaticVecOrMat, b::StaticVecOrMat, c::StaticVecOrMat...) = vcat(vcat(a,b), vcat(c...))
94+
9595
@generated function _vcat(::Size{Sa}, ::Size{Sb}, a::StaticVecOrMat, b::StaticVecOrMat) where {Sa, Sb}
9696
if Size(Sa)[2] != Size(Sb)[2]
9797
throw(DimensionMismatch("Tried to vcat arrays of size $Sa and $Sb"))
@@ -118,8 +118,7 @@ end
118118
@inline hcat(a::StaticVector) = similar_type(a, Size(Size(a)[1],1))(a)
119119
@inline hcat(a::StaticMatrix) = a
120120
@inline hcat(a::StaticVecOrMat, b::StaticVecOrMat) = _hcat(Size(a), Size(b), a, b)
121-
@inline hcat(a::StaticVecOrMat, b::StaticVecOrMat, c::StaticVecOrMat...) =
122-
hcat(hcat(a,b), hcat(c...))
121+
@inline hcat(a::StaticVecOrMat, b::StaticVecOrMat, c::StaticVecOrMat...) = hcat(hcat(a,b), hcat(c...))
123122

124123
@generated function _hcat(::Size{Sa}, ::Size{Sb}, a::StaticVecOrMat, b::StaticVecOrMat) where {Sa, Sb}
125124
if Sa[1] != Sb[1]

test/linalg.jl

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,31 @@ using StaticArrays, Test, LinearAlgebra
164164

165165
# issue #388
166166
let x = SVector(1, 2, 3)
167-
# current limit: 34 arguments
168-
hcat(
169-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
170-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
171-
allocs = @allocated hcat(
172-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
173-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
174-
@test allocs == 0
175-
vcat(
176-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
177-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
178-
allocs = @allocated vcat(
179-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
180-
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
181-
@test allocs == 0
167+
if VERSION >= v"0.7.0-beta.47"
168+
# current limit: 34 arguments
169+
hcat(
170+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
171+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
172+
allocs = @allocated hcat(
173+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
174+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
175+
@test allocs == 0
176+
vcat(
177+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
178+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
179+
allocs = @allocated vcat(
180+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x,
181+
x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x)
182+
@test allocs == 0
183+
else
184+
# current limit: 14 arguments
185+
hcat(x, x, x, x, x, x, x, x, x, x, x, x, x, x)
186+
allocs = @allocated hcat(x, x, x, x, x, x, x, x, x, x, x, x, x, x)
187+
@test allocs == 0
188+
vcat(x, x, x, x, x, x, x, x, x, x, x, x, x, x)
189+
allocs = @allocated vcat(x, x, x, x, x, x, x, x, x, x, x, x, x, x)
190+
@test allocs == 0
191+
end
182192
end
183193
end
184194

0 commit comments

Comments
 (0)