Skip to content

Commit

Permalink
Fix searchsorted for new LazyArrays vcat specialised (#58)
Browse files Browse the repository at this point in the history
* Fix searchsorted for new LazyArrays vcat specialised

* v0.9.1

* Fix permutedims(::ReshapedArray)
  • Loading branch information
dlfivefifty authored Jan 27, 2021
1 parent 1e405be commit 1fea087
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "InfiniteArrays"
uuid = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
version = "0.9.0"
version = "0.9.1"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand All @@ -14,7 +14,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
ArrayLayouts = "0.5"
DSP = "0.6"
FillArrays = "0.11"
LazyArrays = "0.20"
LazyArrays = "0.20.2"
julia = "1.5"

[extras]
Expand Down
9 changes: 9 additions & 0 deletions src/InfiniteArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ function searchsortedlast(v::AbstractVector, x, lo::Int, hi::Infinity, o::Orderi
return lo
end

# special case for Vcat
@inline function LazyArrays.searchsortedlast_recursive(::Infinity, x, a, args...)
n = sum(map(length,args))
r = searchsortedlast(a, x)
r > 0 && return n + r
return LazyArrays.searchsortedlast_recursive(n, x, args...)
end


##
# lazy sub_materialize
##
Expand Down
9 changes: 8 additions & 1 deletion src/reshapedarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,11 @@ BroadcastStyle(::Type{<:ReshapedArray{T,2,<:Any,<:Tuple{<:Any,<:Infinity}}}) whe
BroadcastStyle(::Type{<:ReshapedArray{T,2,<:Any,<:Tuple{<:Infinity,<:Any}}}) where {T} = LazyArrayStyle{2}()


MemoryLayout(::Type{<:ReshapedArray{T,N,A,DIMS}}) where {T,N,A,DIMS} = reshapedlayout(MemoryLayout(A), DIMS)
MemoryLayout(::Type{<:ReshapedArray{T,N,A,DIMS}}) where {T,N,A,DIMS} = reshapedlayout(MemoryLayout(A), DIMS)


###
# permutedims for reshaped unrolls
###

permutedims(R::ReshapedArray{<:Any,2,<:AbstractVector}) = parent(R)
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ end
@test permutedims(1:∞)[1,1:10] == (1:10)
a = reshape(Vcat(Fill(1,1,∞),Fill(2,2,∞)),∞)
@test a[1:7] == [1, 2, 2, 1, 2, 2, 1]
@test permutedims(permutedims(1:∞)) 1:
end

@testset "norm/dot" begin
Expand Down

2 comments on commit 1fea087

@dlfivefifty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/28810

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.1 -m "<description of version>" 1fea087b023b27dea8cc87e672e413dda2db0452
git push origin v0.9.1

Please sign in to comment.