Skip to content

Commit

Permalink
Revert Base._cat overload (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarrasch authored Dec 11, 2020
1 parent 580cc97 commit 7ed1d16
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: TagBot
on:
schedule:
- cron: '00 00 * * *'
issue_comment:
types:
- created
workflow_dispatch:
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
runs-on: ubuntu-latest
steps:
- uses: JuliaRegistries/TagBot@v1
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "LinearMaps"
uuid = "7a12625a-238d-50fd-b39a-03d52299707e"
version = "3.0"
version = "3.0.1"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
32 changes: 17 additions & 15 deletions src/blockmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -442,20 +442,22 @@ for k in 1:8 # is 8 sufficient?
mapargs = ntuple(n ->:($(Symbol(:A, n))), Val(k-1))
# yields (:LinearMap(A1), :LinearMap(A2), ..., :LinearMap(A(k-1)))

@eval function SparseArrays.blockdiag($(Is...), $L, As::MapOrVecOrMat...)
return BlockDiagonalMap(convert_to_lmaps($(mapargs...))...,
$(Symbol(:A, k)),
convert_to_lmaps(As...)...)
end
end
@eval begin
function SparseArrays.blockdiag($(Is...), $L, As::MapOrVecOrMat...)
return BlockDiagonalMap(convert_to_lmaps($(mapargs...))...,
$(Symbol(:A, k)),
convert_to_lmaps(As...)...)
end

# This method is more generic than Base._cat(catdims, A::AbstractArray...), and
# therefore does not override Base/StdLib behavior
function Base._cat(dims, As::MapOrVecOrMat...)
if dims::Dims{2} == (1, 2)
return BlockDiagonalMap(convert_to_lmaps(As...)...)
else
throw(ArgumentError("dims keyword in cat of LinearMaps must be (1,2)"))
function Base.cat($(Is...), $L, As::MapOrVecOrMat...; dims::Dims{2})
if dims == (1,2)
return BlockDiagonalMap(convert_to_lmaps($(mapargs...))...,
$(Symbol(:A, k)),
convert_to_lmaps(As...)...)
else
throw(ArgumentError("dims keyword in cat of LinearMaps must be (1,2)"))
end
end
end
end

Expand All @@ -472,8 +474,8 @@ SparseArrays.blockdiag
cat(As::Union{LinearMap,AbstractVecOrMat}...; dims=(1,2))::BlockDiagonalMap
Construct a (lazy) representation of the diagonal concatenation of the arguments.
To avoid fallback to the generic `Base.cat`, there must be a `LinearMap` object
among the arguments, without any restriction on its position.
To avoid fallback to the generic `Base.cat`, there must be a `LinearMap`
object among the first 8 arguments.
"""
Base.cat

Expand Down

2 comments on commit 7ed1d16

@dkarrasch
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/26230

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.0.1 -m "<description of version>" 7ed1d166aa139e108b7cc053f2e4bda73faad684
git push origin v3.0.1

Please sign in to comment.