@@ -263,17 +263,20 @@ function blocks_to_cartesianindices(d::Dictionary{<:Block})
263
263
return Dictionary (blocks_to_cartesianindices (eachindex (d)), d)
264
264
end
265
265
266
- function blockreshape (a:: AbstractArray , dims:: Tuple{Vararg{Vector{Int}}} )
266
+ function blockreshape (a:: AbstractArray , dims:: Tuple{Vector{Int}, Vararg{Vector{Int}}} )
267
267
return blockreshape (a, blockedrange .(dims))
268
268
end
269
-
270
- function blockreshape (a:: AbstractArray , dims:: Vararg{Vector{Int}} )
271
- return blockreshape (a, dims)
269
+ function blockreshape (a:: AbstractArray , dim1:: Vector{Int} , dim_rest:: Vararg{Vector{Int}} )
270
+ return blockreshape (a, (dim1, dim_rest... ))
271
+ end
272
+ # Fix ambiguity error.
273
+ function blockreshape (a:: AbstractArray )
274
+ return blockreshape (a, ())
272
275
end
273
276
274
277
tuple_oneto (n) = ntuple (identity, n)
275
278
276
- function blockreshape (a:: AbstractArray , axes:: Tuple{Vararg{AbstractUnitRange}} )
279
+ function _blockreshape (a:: AbstractArray , axes:: Tuple{Vararg{AbstractUnitRange}} )
277
280
reshaped_blocks_a = reshape (blocks (a), blocklength .(axes))
278
281
reshaped_a = similar (a, axes)
279
282
for I in eachstoredindex (reshaped_blocks_a)
@@ -284,8 +287,20 @@ function blockreshape(a::AbstractArray, axes::Tuple{Vararg{AbstractUnitRange}})
284
287
return reshaped_a
285
288
end
286
289
287
- function blockreshape (a:: AbstractArray , axes:: Vararg{AbstractUnitRange} )
288
- return blockreshape (a, axes)
290
+ function blockreshape (
291
+ a:: AbstractArray , axes:: Tuple{AbstractUnitRange,Vararg{AbstractUnitRange}}
292
+ )
293
+ return _blockreshape (a, axes)
294
+ end
295
+ # Fix ambiguity error.
296
+ function blockreshape (a:: AbstractArray , axes:: Tuple{} )
297
+ return _blockreshape (a, axes)
298
+ end
299
+
300
+ function blockreshape (
301
+ a:: AbstractArray , axis1:: AbstractUnitRange , axes_rest:: Vararg{AbstractUnitRange}
302
+ )
303
+ return blockreshape (a, (axis1, axes_rest... ))
289
304
end
290
305
291
306
function cartesianindices (axes:: Tuple , b:: Block )
0 commit comments