From 58d3a7f3f9cac3048523c5c7860dfb148c29903e Mon Sep 17 00:00:00 2001 From: Daniel VandenHeuvel <95613936+DanielVandH@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:06:29 +0000 Subject: [PATCH 1/2] maximum --- Project.toml | 2 +- ext/InfiniteArraysBlockArraysExt.jl | 6 ++++-- test/test_infblock.jl | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 79594ab..39f9007 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "InfiniteArrays" uuid = "4858937d-0d70-526a-a4dd-2d5cb5dd786c" -version = "0.15.1" +version = "0.15.2" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/ext/InfiniteArraysBlockArraysExt.jl b/ext/InfiniteArraysBlockArraysExt.jl index 5733823..ac7cd0a 100644 --- a/ext/InfiniteArraysBlockArraysExt.jl +++ b/ext/InfiniteArraysBlockArraysExt.jl @@ -2,10 +2,10 @@ module InfiniteArraysBlockArraysExt using InfiniteArrays, BlockArrays using InfiniteArrays.ArrayLayouts, InfiniteArrays.LazyArrays, InfiniteArrays.LinearAlgebra -import Base: length, size, axes, BroadcastStyle, copy, +, - +import Base: length, size, axes, BroadcastStyle, copy, +, -, maximum, OneTo import Base.Broadcast: Broadcasted import ArrayLayouts: sub_materialize, axes_print_matrix_row -import InfiniteArrays: OneToInf, PosInfinity, InfRanges, RealInfinity, Infinity, InfStepRange, TridiagonalToeplitzLayout +import InfiniteArrays: OneToInf, PosInfinity, InfRanges, RealInfinity, Infinity, InfStepRange, TridiagonalToeplitzLayout, InfiniteCardinal import BlockArrays: AbstractBlockLayout, sizes_from_blocks, BlockTridiagonal, OneToCumsum, BlockSlice, AbstractBlockedUnitRange, BlockLayout import LazyArrays: PaddedColumns, LazyArrayStyle @@ -28,6 +28,8 @@ BlockArrays.blocklasts(a::InfRanges) = Fill(length(a),1) BlockArrays.findblock(::BlockedOneTo, ::RealInfinity) = Block(ℵ₀) +maximum(::BlockRange{1, Tuple{OneTo{InfiniteCardinal{0}}}}) = Block(ℵ₀) + function BlockArrays.sortedunion(a::Vcat{Int,1,<:Tuple{Union{Int,AbstractVector{Int}},<:AbstractRange}}, b::Vcat{Int,1,<:Tuple{Union{Int,AbstractVector{Int}},<:AbstractRange}}) @assert a == b # TODO: generailse? Not sure how to do so in a type stable fashion diff --git a/test/test_infblock.jl b/test/test_infblock.jl index ce36cff..15ffdc2 100644 --- a/test/test_infblock.jl +++ b/test/test_infblock.jl @@ -139,6 +139,10 @@ const BlockTriPertToeplitz = InfiniteArraysBlockArraysExt.BlockTriPertToeplitz @test findblock(blockedrange(1:2:∞), RealInfinity()) == Block(ℵ₀) end + @testset "maximum of Inf Block Range, HarmonicOrthogonalPolynomials#88" begin + @test maximum(Block.(Base.OneTo(Integer(+∞)))) == Block(ℵ₀) + end + @testset "BlockTridiagonal Pert Toeplitz" begin A = BlockTridiagonal(Vcat([fill(1.0, 2, 1), Matrix(1.0I, 2, 2), Matrix(1.0I, 2, 2), Matrix(1.0I, 2, 2)], Fill(Matrix(1.0I, 2, 2), ∞)), Vcat([zeros(1, 1)], Fill(zeros(2, 2), ∞)), From 3629eab88854ebca72d41e17497bc9cc90e80e8f Mon Sep 17 00:00:00 2001 From: Daniel VandenHeuvel <95613936+DanielVandH@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:07:45 +0000 Subject: [PATCH 2/2] mention pr --- test/test_infblock.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_infblock.jl b/test/test_infblock.jl index 15ffdc2..2130715 100644 --- a/test/test_infblock.jl +++ b/test/test_infblock.jl @@ -139,7 +139,8 @@ const BlockTriPertToeplitz = InfiniteArraysBlockArraysExt.BlockTriPertToeplitz @test findblock(blockedrange(1:2:∞), RealInfinity()) == Block(ℵ₀) end - @testset "maximum of Inf Block Range, HarmonicOrthogonalPolynomials#88" begin + @testset "maximum of Inf Block Range" begin + # See https://github.com/JuliaApproximation/HarmonicOrthogonalPolynomials.jl/pull/89 @test maximum(Block.(Base.OneTo(Integer(+∞)))) == Block(ℵ₀) end