Skip to content

Commit 13184d6

Browse files
authored
Support maximum(Block(OneTo(+∞)) (#211)
* maximum * mention pr
1 parent 854d430 commit 13184d6

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "InfiniteArrays"
22
uuid = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
3-
version = "0.15.1"
3+
version = "0.15.2"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

ext/InfiniteArraysBlockArraysExt.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ module InfiniteArraysBlockArraysExt
22
using InfiniteArrays, BlockArrays
33
using InfiniteArrays.ArrayLayouts, InfiniteArrays.LazyArrays, InfiniteArrays.LinearAlgebra
44

5-
import Base: length, size, axes, BroadcastStyle, copy, +, -
5+
import Base: length, size, axes, BroadcastStyle, copy, +, -, maximum, OneTo
66
import Base.Broadcast: Broadcasted
77
import ArrayLayouts: sub_materialize, axes_print_matrix_row
8-
import InfiniteArrays: OneToInf, PosInfinity, InfRanges, RealInfinity, Infinity, InfStepRange, TridiagonalToeplitzLayout
8+
import InfiniteArrays: OneToInf, PosInfinity, InfRanges, RealInfinity, Infinity, InfStepRange, TridiagonalToeplitzLayout, InfiniteCardinal
99
import BlockArrays: AbstractBlockLayout, sizes_from_blocks, BlockTridiagonal, OneToCumsum, BlockSlice, AbstractBlockedUnitRange,
1010
BlockLayout
1111
import LazyArrays: PaddedColumns, LazyArrayStyle
@@ -28,6 +28,8 @@ BlockArrays.blocklasts(a::InfRanges) = Fill(length(a),1)
2828

2929
BlockArrays.findblock(::BlockedOneTo, ::RealInfinity) = Block(ℵ₀)
3030

31+
maximum(::BlockRange{1, Tuple{OneTo{InfiniteCardinal{0}}}}) = Block(ℵ₀)
32+
3133
function BlockArrays.sortedunion(a::Vcat{Int,1,<:Tuple{Union{Int,AbstractVector{Int}},<:AbstractRange}},
3234
b::Vcat{Int,1,<:Tuple{Union{Int,AbstractVector{Int}},<:AbstractRange}})
3335
@assert a == b # TODO: generailse? Not sure how to do so in a type stable fashion

test/test_infblock.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ const BlockTriPertToeplitz = InfiniteArraysBlockArraysExt.BlockTriPertToeplitz
139139
@test findblock(blockedrange(1:2:∞), RealInfinity()) == Block(ℵ₀)
140140
end
141141

142+
@testset "maximum of Inf Block Range" begin
143+
# See https://github.com/JuliaApproximation/HarmonicOrthogonalPolynomials.jl/pull/89
144+
@test maximum(Block.(Base.OneTo(Integer(+∞)))) == Block(ℵ₀)
145+
end
146+
142147
@testset "BlockTridiagonal Pert Toeplitz" begin
143148
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), ∞)),
144149
Vcat([zeros(1, 1)], Fill(zeros(2, 2), ∞)),

0 commit comments

Comments
 (0)