@@ -112,21 +112,25 @@ end
112112
113113# * `Value` is not owned by Convex.jl
114114# * splatting creates zero-argument functions, which again are not owned by Convex.jl
115+ Base. hcat (args:: AbstractExpr... ) = HcatAtom (args... )
115116
116- hcat (args:: AbstractExpr... ) = HcatAtom (args... )
117- function hcat (args:: AbstractExprOrValue... )
117+ function Base. hcat (args:: AbstractExprOrValue... )
118+ if all (Base. Fix2 (isa, Value), args)
119+ return Base. cat (args... , dims = Val (2 ))
120+ end
118121 return HcatAtom (map (arg -> convert (AbstractExpr, arg), args)... )
119122end
120- hcat (args:: Value... ) = Base. cat (args... , dims = Val (2 ))
121123
122124# TODO : implement vertical concatenation in a more efficient way
123125vcat (args:: AbstractExpr... ) = transpose (HcatAtom (map (transpose, args)... ))
124126function vcat (args:: AbstractExprOrValue... )
127+ if all (Base. Fix2 (isa, Value), args)
128+ return Base. cat (args... , dims = Val (1 ))
129+ end
125130 return transpose (
126131 HcatAtom (map (arg -> transpose (convert (AbstractExpr, arg)), args)... ),
127132 )
128133end
129- vcat (args:: Value... ) = Base. cat (args... , dims = Val (1 )) # Note: this makes general vcat slower for anyone using Convex...
130134
131135function hvcat (rows:: Tuple{Vararg{Int}} , args:: AbstractExprOrValue... )
132136 nbr = length (rows)
0 commit comments