|
292 | 292 | # in A to matrices of type T and sizes given by n[k:end]. n is an array |
293 | 293 | # so that the same promotion code can be used for hvcat. We pass the type T |
294 | 294 | # so that we can re-use this code for sparse-matrix hcat etcetera. |
295 | | -promote_to_arrays_(n::Int, ::Type{Matrix}, a::T) where {T<:Number} = copyto!(Matrix{T}(undef, 1, 1), a) |
| 295 | +promote_to_arrays_(n::Int, ::Type, a::T) where {T<:Number} = copyto!(Vector{T}(undef, 1), a) |
296 | 296 | promote_to_arrays_(n::Int, ::Type{Matrix}, J::UniformScaling{T}) where {T} = copyto!(Matrix{T}(undef, n, n), J) |
297 | 297 | promote_to_arrays_(n::Int, ::Type, A::AbstractVecOrMat) = A |
298 | 298 | promote_to_arrays(n,k, ::Type) = () |
@@ -369,16 +369,16 @@ function hvcat(rows::Tuple{Vararg{Int}}, A::Union{AbstractVecOrMat,UniformScalin |
369 | 369 | j = 0 |
370 | 370 | for i = 1:nr |
371 | 371 | if rows[i] > 0 && n[j+1] == -1 # this row consists entirely of UniformScalings |
372 | | - nci = nc ÷ rows[i] |
373 | | - nci * rows[i] != nc && throw(DimensionMismatch("indivisible UniformScaling sizes")) |
| 372 | + nci, r = divrem(nc, rows[i]) |
| 373 | + r != 0 && throw(DimensionMismatch("indivisible UniformScaling sizes")) |
374 | 374 | for k = 1:rows[i] |
375 | 375 | n[j+k] = nci |
376 | 376 | end |
377 | 377 | end |
378 | 378 | j += rows[i] |
379 | 379 | end |
380 | 380 | end |
381 | | - return hvcat(rows, promote_to_arrays(n,1, promote_to_array_type(A), A...)...) |
| 381 | + return hvcat(rows, promote_to_arrays(n, 1, promote_to_array_type(A), A...)...) |
382 | 382 | end |
383 | 383 |
|
384 | 384 | ## Matrix construction from UniformScaling |
|
0 commit comments