@@ -442,20 +442,22 @@ for k in 1:8 # is 8 sufficient?
442
442
mapargs = ntuple (n -> :($ (Symbol (:A , n))), Val (k- 1 ))
443
443
# yields (:LinearMap(A1), :LinearMap(A2), ..., :LinearMap(A(k-1)))
444
444
445
- @eval function SparseArrays . blockdiag ( $ (Is ... ), $ L, As :: MapOrVecOrMat... )
446
- return BlockDiagonalMap ( convert_to_lmaps ( $ (mapargs ... )) ... ,
447
- $ ( Symbol ( :A , k)) ,
448
- convert_to_lmaps (As ... ) ... )
449
- end
450
- end
445
+ @eval begin
446
+ function SparseArrays . blockdiag ( $ (Is ... ), $ L, As :: MapOrVecOrMat ...)
447
+ return BlockDiagonalMap ( convert_to_lmaps ( $ (mapargs ... )) ... ,
448
+ $ ( Symbol ( :A , k)),
449
+ convert_to_lmaps (As ... ) ... )
450
+ end
451
451
452
- # This method is more generic than Base._cat(catdims, A::AbstractArray...), and
453
- # therefore does not override Base/StdLib behavior
454
- function Base. _cat (dims, As:: MapOrVecOrMat... )
455
- if dims:: Dims{2} == (1 , 2 )
456
- return BlockDiagonalMap (convert_to_lmaps (As... )... )
457
- else
458
- throw (ArgumentError (" dims keyword in cat of LinearMaps must be (1,2)" ))
452
+ function Base. cat ($ (Is... ), $ L, As:: MapOrVecOrMat... ; dims:: Dims{2} )
453
+ if dims == (1 ,2 )
454
+ return BlockDiagonalMap (convert_to_lmaps ($ (mapargs... ))... ,
455
+ $ (Symbol (:A , k)),
456
+ convert_to_lmaps (As... )... )
457
+ else
458
+ throw (ArgumentError (" dims keyword in cat of LinearMaps must be (1,2)" ))
459
+ end
460
+ end
459
461
end
460
462
end
461
463
@@ -472,8 +474,8 @@ SparseArrays.blockdiag
472
474
cat(As::Union{LinearMap,AbstractVecOrMat}...; dims=(1,2))::BlockDiagonalMap
473
475
474
476
Construct a (lazy) representation of the diagonal concatenation of the arguments.
475
- To avoid fallback to the generic `Base.cat`, there must be a `LinearMap` object
476
- among the arguments, without any restriction on its position .
477
+ To avoid fallback to the generic `Base.cat`, there must be a `LinearMap`
478
+ object among the first 8 arguments .
477
479
"""
478
480
Base. cat
479
481
0 commit comments