Skip to content

Commit 0049f1b

Browse files
authored
LazyArrays v2.0 support (#174)
* Support LazyArrays v2.0 * add block array tests * Update Project.toml * Fix padded * ambiguity with sublayout of ApplyBandedLayout * Julia v1.10 restriction * Revert "ambiguity with sublayout of ApplyBandedLayout" This reverts commit 31038e9. * add tests * Update Project.toml
1 parent 99d9671 commit 0049f1b

File tree

6 files changed

+36
-16
lines changed

6 files changed

+36
-16
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ jobs:
3636
fail-fast: false
3737
matrix:
3838
version:
39-
- '1.6'
40-
- '1'
39+
- '1.10'
4140
os:
4241
- ubuntu-latest
4342
- macOS-latest

Project.toml

Lines changed: 7 additions & 7 deletions
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.13.8"
3+
version = "0.14"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -14,18 +14,18 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1414
[compat]
1515
Aqua = "0.8"
1616
ArrayLayouts = "1.8"
17-
BandedMatrices = "0.17.18, 1.0"
17+
BandedMatrices = "1.0"
18+
BlockArrays = "1.0"
1819
Base64 = "1"
1920
DSP = "0.7"
2021
FillArrays = "1.0"
2122
Infinities = "0.1.1"
22-
LazyArrays = "1.0"
23-
LazyBandedMatrices = "0.8.9, 0.9"
23+
LazyArrays = "2.0.2"
2424
LinearAlgebra = "1.6"
2525
SparseArrays = "1"
2626
Statistics = "1"
2727
Test = "1"
28-
julia = "1.6"
28+
julia = "1.10"
2929

3030
[extensions]
3131
InfiniteArraysDSPExt = "DSP"
@@ -35,14 +35,14 @@ InfiniteArraysStatisticsExt = "Statistics"
3535
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3636
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
3737
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
38+
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
3839
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
39-
LazyBandedMatrices = "d7e5e226-e90b-4449-9968-0f923699bf6f"
4040
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
4141
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
4242
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4343

4444
[targets]
45-
test = ["Aqua", "Test", "BandedMatrices", "LazyBandedMatrices", "Statistics", "SparseArrays", "Base64", "DSP"]
45+
test = ["Aqua", "Test", "BandedMatrices", "BlockArrays", "Statistics", "SparseArrays", "Base64", "DSP"]
4646

4747
[weakdeps]
4848
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"

src/InfiniteArrays.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ import FillArrays: AbstractFill, Eye, Fill, Ones, RectDiagonal, Zeros, fill_resh
4242
import Infinities: InfiniteCardinal, Infinity, ∞
4343

4444
import LazyArrays: AbstractCachedVector, ApplyLayout, CachedArray, CachedVector, InvColumnLayout,
45-
LazyArrayStyle, LazyLayout, LazyMatrix, PaddedLayout, _padded_sub_materialize, sub_paddeddata
45+
LazyArrayStyle, LazyLayout, LazyMatrix, PaddedColumns, _padded_sub_materialize, sub_paddeddata
4646

4747
import LinearAlgebra: AdjOrTrans, HermOrSym, diag, norm, norm1, norm2, normp
4848

49+
import LazyArrays: AbstractPaddedLayout
50+
4951
export ∞, ℵ₀, Hcat, Vcat, Zeros, Ones, Fill, Eye, BroadcastArray, cache
5052
import Base: unitrange, oneto
5153

src/infarrays.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ sub_materialize(::AbstractBandedLayout, V, ::Tuple{InfAxes,OneTo{Int}}) = V
295295
##
296296

297297
sublayout(::DiagonalLayout{L}, ::Type{<:Tuple{KR,Integer}}) where {L,KR<:InfAxes} =
298-
sublayout(PaddedLayout{UnknownLayout}(), Tuple{KR})
298+
sublayout(PaddedColumns{UnknownLayout}(), Tuple{KR})
299299
sublayout(::DiagonalLayout{L}, ::Type{<:Tuple{Integer,JR}}) where {L,JR<:InfAxes} =
300-
sublayout(PaddedLayout{UnknownLayout}(), Tuple{JR})
300+
sublayout(PaddedColumns{UnknownLayout}(), Tuple{JR})
301301
-
302302

303303
sublayout(::AbstractBandedLayout, ::Type{<:Tuple{KR,Integer}}) where {KR<:InfAxes} =
304-
sublayout(PaddedLayout{UnknownLayout}(), Tuple{KR})
304+
sublayout(PaddedColumns{UnknownLayout}(), Tuple{KR})
305305
sublayout(::AbstractBandedLayout, ::Type{<:Tuple{Integer,JR}}) where {JR<:InfAxes} =
306-
sublayout(PaddedLayout{UnknownLayout}(), Tuple{JR})
306+
sublayout(PaddedColumns{UnknownLayout}(), Tuple{JR})
307307

308308

309309
function sub_paddeddata(::AbstractBandedLayout, S::SubArray{T,1,<:AbstractMatrix,<:Tuple{InfAxes,Integer}}) where T
@@ -393,7 +393,7 @@ sub_materialize(::ApplyLayout{typeof(hcat)}, V::AbstractMatrix, ::Tuple{<:Any,In
393393
sub_materialize(::ApplyLayout{typeof(hcat)}, V::AbstractMatrix, ::Tuple{InfAxes,Any}) = ApplyArray(V)
394394

395395

396-
sub_materialize(::PaddedLayout, v::AbstractVector{T}, ::Tuple{InfAxes}) where T =
396+
sub_materialize(::AbstractPaddedLayout, v::AbstractVector{T}, ::Tuple{InfAxes}) where T =
397397
_padded_sub_materialize(v)
398398

399399
sub_materialize(lay::InvColumnLayout, v::AbstractVector, ax::Tuple{InfAxes}) =

test/runtests.jl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using LinearAlgebra, SparseArrays, InfiniteArrays, Infinities, FillArrays, LazyArrays, Statistics, Test, Base64
2-
using BandedMatrices, LazyBandedMatrices
2+
using BandedMatrices
33
import InfiniteArrays: InfUnitRange, InfStepRange, OneToInf, NotANumber, oneto, unitrange
44
import LazyArrays: CachedArray, MemoryLayout, LazyLayout, DiagonalLayout, LazyArrayStyle, colsupport, DualLayout
55
import BandedMatrices: _BandedMatrix, BandedColumns
@@ -1208,4 +1208,13 @@ end
12081208
@inferred Val((D -> diag(D,1))(D))
12091209
end
12101210

1211+
@testset "inf padded" begin
1212+
v = Vcat(1, Zeros(∞))
1213+
@test LazyArrays.sub_materialize(view(v, 1:∞))[1:10] == [1; zeros(9)]
1214+
@test LazyArrays.sub_materialize(view(v, 2:∞))[1:10] == zeros(10)
1215+
@test v[2:∞] isa Zeros
1216+
@test v[1:∞] == v
1217+
end
1218+
12111219
include("test_infconv.jl")
1220+
include("test_block.jl")

test/test_block.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using InfiniteArrays, BlockArrays
2+
using InfiniteArrays: OneToInf
3+
4+
@testset "blockedonetoinf" begin
5+
b = blockedrange(OneToInf())
6+
b2 = b .+ b;
7+
for i in 1:10
8+
@test b2[Block(i)] == b[Block(i)] + b[Block(i)]
9+
end
10+
end

0 commit comments

Comments
 (0)