Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
DSP = "0.6"
FillArrays = "0.9.4"
LazyArrays = "0.17.3, 0.18"
FillArrays = "0.9.6"
LazyArrays = "0.18.1"
julia = "1.5"

[extras]
Expand Down
6 changes: 5 additions & 1 deletion src/InfiniteArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import Statistics: mean, median

import FillArrays: AbstractFill, getindex_value, fill_reshape, RectDiagonal
import LazyArrays: LazyArrayStyle, AbstractBandedLayout, MemoryLayout, LazyLayout, UnknownLayout,
ZerosLayout, AbstractArrayApplyStyle, CachedArray, CachedVector,
ZerosLayout, AbstractArrayApplyStyle, CachedArray, CachedVector, ApplyLayout,
reshapedlayout, sub_materialize, LayoutMatrix, LayoutVector, _padded_sub_materialize, PaddedLayout

import DSP: conv
Expand Down Expand Up @@ -228,6 +228,10 @@ sub_materialize(_, V, ::Tuple{InfAxes,InfAxes}) = V
sub_materialize(_, V, ::Tuple{<:Any,InfAxes}) = V
sub_materialize(_, V, ::Tuple{InfAxes,Any}) = V

sub_materialize(::ApplyLayout{typeof(vcat)}, V::AbstractMatrix, ::Tuple{InfAxes,InfAxes}) = ApplyArray(V)
sub_materialize(::ApplyLayout{typeof(vcat)}, V::AbstractMatrix, ::Tuple{<:Any,InfAxes}) = ApplyArray(V)
sub_materialize(::ApplyLayout{typeof(vcat)}, V::AbstractMatrix, ::Tuple{InfAxes,Any}) = ApplyArray(V)

sub_materialize(::PaddedLayout, v::AbstractVector{T}, ::Tuple{InfAxes}) where T =
_padded_sub_materialize(v)

Expand Down
22 changes: 21 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ end
@test colsupport(A,1) == 1:1
@test Base.replace_in_print_matrix(A, 2, 1, "0") == "⋅"
@test stringmime("text/plain", A; context=(:limit => true)) ==
"∞-element ApplyArray{Float64,1,typeof(vcat),Tuple{$Int,Zeros{Float64,1,Tuple{OneToInf{$Int}}}}} with indices OneToInf():\n 1.0\n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋮"
"vcat($Int, ∞-element Zeros{Float64,1,Tuple{OneToInf{$Int}}} with indices OneToInf()) with indices OneToInf():\n 1.0\n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋅ \n ⋮"
A = Vcat(Ones{Int}(1,∞), Diagonal(1:∞))
@test Base.replace_in_print_matrix(A, 2, 2, "0") == "⋅"
end
Expand All @@ -710,6 +710,26 @@ end
@test Base.copymutable(Vcat([1.,2.], zeros(∞))) isa CachedArray
@test Base.copymutable(Vcat(1.,2., zeros(∞))) isa CachedArray
end

@testset "infinite indexing" begin
a = Vcat(1, 1:∞)
@test a[:] isa Vcat
@test a[3:∞] ≡ 2:∞
@test a[3:2:∞] isa Vcat

A = Vcat(Ones(1,∞), Fill(2,1,∞))
@test A[:,:] == A
@test A[:,2:∞] isa Vcat

A = Vcat(Ones(5,5), Fill(2,∞,5))
@test A[:,:] == A
@test A[2:∞,:] isa Vcat

A = Vcat(Ones(1,∞), Fill(2,∞,∞))
@test A[:,:] == A
@test A[2:∞,2:∞] isa Vcat
@test A[2:∞,2:∞][1:10,1:10] == fill(2,10,10)
end
end

@testset "broadcasting" begin
Expand Down