Skip to content

Commit 1fea087

Browse files
authored
Fix searchsorted for new LazyArrays vcat specialised (#58)
* Fix searchsorted for new LazyArrays vcat specialised * v0.9.1 * Fix permutedims(::ReshapedArray)
1 parent 1e405be commit 1fea087

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Project.toml

Lines changed: 2 additions & 2 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.9.0"
3+
version = "0.9.1"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -14,7 +14,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1414
ArrayLayouts = "0.5"
1515
DSP = "0.6"
1616
FillArrays = "0.11"
17-
LazyArrays = "0.20"
17+
LazyArrays = "0.20.2"
1818
julia = "1.5"
1919

2020
[extras]

src/InfiniteArrays.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,15 @@ function searchsortedlast(v::AbstractVector, x, lo::Int, hi::Infinity, o::Orderi
218218
return lo
219219
end
220220

221+
# special case for Vcat
222+
@inline function LazyArrays.searchsortedlast_recursive(::Infinity, x, a, args...)
223+
n = sum(map(length,args))
224+
r = searchsortedlast(a, x)
225+
r > 0 && return n + r
226+
return LazyArrays.searchsortedlast_recursive(n, x, args...)
227+
end
228+
229+
221230
##
222231
# lazy sub_materialize
223232
##

src/reshapedarray.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,11 @@ BroadcastStyle(::Type{<:ReshapedArray{T,2,<:Any,<:Tuple{<:Any,<:Infinity}}}) whe
6868
BroadcastStyle(::Type{<:ReshapedArray{T,2,<:Any,<:Tuple{<:Infinity,<:Any}}}) where {T} = LazyArrayStyle{2}()
6969

7070

71-
MemoryLayout(::Type{<:ReshapedArray{T,N,A,DIMS}}) where {T,N,A,DIMS} = reshapedlayout(MemoryLayout(A), DIMS)
71+
MemoryLayout(::Type{<:ReshapedArray{T,N,A,DIMS}}) where {T,N,A,DIMS} = reshapedlayout(MemoryLayout(A), DIMS)
72+
73+
74+
###
75+
# permutedims for reshaped unrolls
76+
###
77+
78+
permutedims(R::ReshapedArray{<:Any,2,<:AbstractVector}) = parent(R)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,7 @@ end
953953
@test permutedims(1:∞)[1,1:10] == (1:10)
954954
a = reshape(Vcat(Fill(1,1,∞),Fill(2,2,∞)),∞)
955955
@test a[1:7] == [1, 2, 2, 1, 2, 2, 1]
956+
@test permutedims(permutedims(1:∞)) 1:
956957
end
957958

958959
@testset "norm/dot" begin

0 commit comments

Comments
 (0)