Skip to content

Commit

Permalink
Merge branch 'master' into lazyarrays-ext-load-failure
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Dec 6, 2024
2 parents ab1261a + cc46573 commit bae4e88
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 25 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -42,14 +42,11 @@ jobs:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
Expand All @@ -66,4 +63,4 @@ jobs:
- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: lcov.info
files: lcov.info
4 changes: 2 additions & 2 deletions .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- {repo: ApproxFunBase.jl, group: JuliaApproximation}
- {repo: LazyArrays.jl, group: JuliaArrays}
- {repo: LazyBandedMatrices.jl, group: JuliaLinearAlgebra}
# - {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}
- {repo: InfiniteLinearAlgebra.jl, group: JuliaLinearAlgebra}

steps:
- uses: actions/checkout@v4
Expand All @@ -60,7 +60,7 @@ jobs:
# force it to use this PR's version of the package
Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps
Pkg.update()
Pkg.test() # resolver may fail with test time deps
Pkg.test(test_args=["--downstream_integration_test"]) # resolver may fail with test time deps
catch err
err isa Pkg.Resolve.ResolverError || rethrow()
# If we can't resolve that means this is incompatible by SemVer and this is fine
Expand Down
14 changes: 7 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BlockArrays"
uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
version = "1.1.1"
version = "1.3.0"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand All @@ -21,13 +21,13 @@ BandedMatrices = "1.0"
Documenter = "1.0"
FillArrays = "1.11"
Images = "0.26"
LinearAlgebra = "1.6"
LinearAlgebra = "1"
OffsetArrays = "1.0"
Random = "1.6"
SparseArrays = "1.6"
StaticArrays = "1.6"
Test = "1.6"
julia = "1.6"
Random = "1"
SparseArrays = "1"
StaticArrays = "1"
Test = "1"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Expand Down
4 changes: 0 additions & 4 deletions src/BlockArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,4 @@ include("blockbanded.jl")
@deprecate getblock!(X, A::AbstractBlockArray{T,N}, I::Vararg{Integer, N}) where {T,N} copyto!(X, view(A, Block(I)))
@deprecate setblock!(A::AbstractBlockArray{T,N}, v, I::Vararg{Integer, N}) where {T,N} (A[Block(I...)] = v)

if !isdefined(Base, :get_extension)
include("../ext/BlockArraysBandedMatricesExt.jl")
end

end # module
7 changes: 4 additions & 3 deletions src/blockindices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ last(b::Block) = b
iterate(x::Block) = (x, nothing)
iterate(x::Block, ::Any) = nothing
isempty(x::Block) = false
broadcastable(x::Block) = x
broadcastable(x::Block) = Ref(x)
ndims(::Type{<:Block}) = 0
ndims(::Block) = 0
eltype(::Type{B}) where B<:Block = B
getindex(B::Block, ::CartesianIndex{0}) = B

# The following code is taken from CartesianIndex
@inline (+)(index::Block{N}) where {N} = Block{N}(map(+, index.n))
Expand Down Expand Up @@ -147,10 +146,12 @@ struct BlockIndex{N,TI<:Tuple{Vararg{Integer,N}},Tα<:Tuple{Vararg{Integer,N}}}
end

@inline BlockIndex(a::NTuple{N,Block{1}}, b::Tuple) where N = BlockIndex(Int.(a), b)
@inline BlockIndex(::Tuple{}, b::Tuple{}) = BlockIndex{0,Tuple{},Tuple{}}((), ())

@inline BlockIndex(a::Integer, b::Integer) = BlockIndex((a,), (b,))
@inline BlockIndex(a::Tuple, b::Integer) = BlockIndex(a, (b,))
@inline BlockIndex(a::Integer, b::Tuple) = BlockIndex((a,), b)
@inline BlockIndex() = BlockIndex((), ())

@inline BlockIndex(a::Block, b::Tuple) = BlockIndex(a.n, b)
@inline BlockIndex(a::Block, b::Integer) = BlockIndex(a, (b,))
Expand Down Expand Up @@ -202,7 +203,7 @@ BlockIndexRange(block::Block{N}, inds::Vararg{AbstractUnitRange{<:Integer},N}) w

block(R::BlockIndexRange) = R.block

getindex(::Block{0}) = Block()
getindex(::Block{0}) = BlockIndex()
getindex(B::Block{N}, inds::Vararg{Integer,N}) where N = BlockIndex(B,inds)
getindex(B::Block{N}, inds::Vararg{AbstractUnitRange{<:Integer},N}) where N = BlockIndexRange(B,inds)
getindex(B::Block{1}, inds::Colon) = B
Expand Down
2 changes: 1 addition & 1 deletion src/blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ julia> blocksizes(A,2)
```
"""
blocksizes(A::AbstractArray) = BlockSizes(A)
blocksizes(A::AbstractArray, d::Integer) = blocklengths(axes(A, d))
@inline blocksizes(A::AbstractArray, d::Integer) = blocklengths(axes(A, d))

struct BlockSizes{T,N,A<:AbstractArray{<:Any,N}} <: AbstractArray{T,N}
array::A
Expand Down
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using BlockArrays, LinearAlgebra, Test

using Aqua
downstream_test = "--downstream_integration_test" in ARGS
@testset "Project quality" begin
Aqua.test_all(BlockArrays, ambiguities=false)
Aqua.test_all(BlockArrays, ambiguities=false,
stale_deps=!downstream_test)
end

using Documenter
Expand Down
4 changes: 2 additions & 2 deletions test/test_blockarrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ end
@test size(ret) == ()
@test all(iszero, ret)
@test ret[Block()] == zeros()
@test ret[Block()[]] == zeros()
@test ret[Block()[]] == 0
@test ret[] == 0
@test view(ret, Block()) == zeros()
@test Array(ret) == zeros()
Expand All @@ -360,7 +360,7 @@ end
@test all(iszero, ret)
@test ret[] == 0
@test ret[Block()] == zeros()
@test ret[Block()[]] == zeros()
@test ret[Block()[]] == 0
@test Array(ret) == zeros()
ret[] = 1
@test ret[] == 1
Expand Down
1 change: 1 addition & 0 deletions test/test_blockindices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import BlockArrays: BlockIndex, BlockIndexRange, BlockSlice
end

@testset "BlockIndex" begin
@test Block()[] == BlockIndex()
@test Block(1)[1] == BlockIndex((1,),(1,))
@test Block(1)[1:2] == BlockIndexRange(Block(1),(1:2,))
@test Block(1,1)[1,1] == BlockIndex((1,1),(1,1)) == BlockIndex((1,1),(1,))
Expand Down
8 changes: 8 additions & 0 deletions test/test_blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ end
@test blocksizes(A, 1) == [2, 3]
@test blocksizes(A, 2) == [3, 1]
end

@testset "Inference: issue #425" begin
x = BlockedArray(rand(4, 4), [2, 2], [2, 2])
bs1 = @inferred (x -> blocksizes(x, 1))(x)
@test bs1 == [2,2]
bs4 = @inferred (x -> blocksizes(x, 4))(x)
@test bs4 == 1:1
end
end

end # module

0 comments on commit bae4e88

Please sign in to comment.