Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing with StepRanges at infinity #89

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

DanielVandH
Copy link
Member

Needs JuliaLinearAlgebra/InfiniteLinearAlgebra.jl#190 to be merged before the tests will pass here.

Fixes #88.

@DanielVandH
Copy link
Member Author

No idea what the deal is with the segfaults on macOS (not reproducible on Windows) but it's hanging on ubuntu because

(HarmonicOrthogonalPolynomials) julia> JR = Block.(OneTo(Integer(+∞)))
BlockRange(Base.OneTo(ℵ₀))

(HarmonicOrthogonalPolynomials) julia> maximum(JR) # hangs
WARNING: Force throwing a SIGINT
ERROR: InterruptException:
Stacktrace:
  [1] _foldl_impl(op::Base.BottomRF{typeof(max)}, init::Base._InitialValue, itr::BlockArrays.BlockRange{1, Tuple{…}})
    @ Base .\reduce.jl:63
  [2] foldl_impl(op::Base.BottomRF{typeof(max)}, nt::Base._InitialValue, itr::BlockArrays.BlockRange{1, Tuple{Base.OneTo{…}}})
    @ Base .\reduce.jl:48
  [3] mapfoldl_impl(f::typeof(identity), op::typeof(max), nt::Base._InitialValue, itr::BlockArrays.BlockRange{1, Tuple{…}})
    @ Base .\reduce.jl:44
  [4] mapfoldl(f::Function, op::Function, itr::BlockArrays.BlockRange{1, Tuple{Base.OneTo{…}}}; init::Base._InitialValue)
    @ Base .\reduce.jl:175
  [5] _mapreduce(f::Function, op::Function, ::IndexCartesian, A::BlockArrays.BlockRange{1, Tuple{Base.OneTo{…}}})
    @ Base .\reduce.jl:450
  [6] _mapreduce_dim(f::Function, op::Function, ::Base._InitialValue, A::BlockArrays.BlockRange{1, Tuple{…}}, ::Colon)
    @ Base .\reducedim.jl:337
  [7] mapreduce(f::Function, op::Function, A::BlockArrays.BlockRange{1, Tuple{…}}; dims::Function, init::Base._InitialValue)
    @ Base .\reducedim.jl:329
  [8] _maximum(f::Function, a::BlockArrays.BlockRange{1, Tuple{Base.OneTo{…}}}, ::Colon; kw::@Kwargs{})
    @ Base .\reducedim.jl:987
  [9] _maximum(a::BlockArrays.BlockRange{1, Tuple{Base.OneTo{Infinities.InfiniteCardinal{0}}}}, ::Colon; kw::@Kwargs{})
    @ Base .\reducedim.jl:986
 [10] maximum(a::BlockArrays.BlockRange{1, Tuple{Base.OneTo{Infinities.InfiniteCardinal{0}}}})
    @ Base .\reducedim.jl:982
 [11] top-level scope
    @ REPL[36]:1
Some type information was truncated. Use `show(err)` to see complete types.

since the call chain is

getindex(P::MultivariateOrthogonalPolynomial{D}, xy::StaticVector{D}, jr::AbstractVector{<:Integer}) where D = P[xy, Block.(OneTo(Integer(findblock(axes(P,2), maximum(jr)))))][jr]
getindex(P::MultivariateOrthogonalPolynomial{D}, xy::StaticVector{D}, JR::BlockRange{1}) where D = P[xy, Block.(OneTo(Int(maximum(JR))))][JR]

I would think that maximum(JR) = Block(ℵ₀) would be a good definition. Could that also go in InfiniteLinearAlgebra.jl @dlfivefifty (unless you have a better workaround for this that avoids a new method)? Technically piracy but I don't see things for infinities in BlockArrays

@dlfivefifty
Copy link
Member

MacOS failure is a known issue with FastTransforms.jl (@MikaelSlevinsky any updates on this?)

I think just remove the MacOS tests for now.

@dlfivefifty
Copy link
Member

I would think that maximum(JR) = Block(ℵ₀) would be a good definition. Could that also go in InfiniteLinearAlgebra.jl

As of InfiniteArrays v0.15 it would go in InfiniteArraysBlockArraysExt.jl

@DanielVandH
Copy link
Member Author

I made JuliaArrays/InfiniteArrays.jl#211

@DanielVandH DanielVandH closed this Dec 9, 2024
@DanielVandH DanielVandH reopened this Dec 9, 2024
@DanielVandH
Copy link
Member Author

Not really sure the best way to fix the stackoverflow here. Might just have to come back to this at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with indexes like S[SphericalCoordinate(0.1,0.2), 1:2:end]
2 participants