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

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

Open
DanielVandH opened this issue Nov 18, 2024 · 3 comments · May be fixed by #89
Open

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

DanielVandH opened this issue Nov 18, 2024 · 3 comments · May be fixed by #89

Comments

@DanielVandH
Copy link
Member

DanielVandH commented Nov 18, 2024

julia> using HarmonicOrthogonalPolynomials

julia> S[SphericalCoordinate(0.1,0.2), 1:2:end]
ERROR: MethodError: no method matching findblock(::BlockArrays.BlockedOneTo{Int64, RangeCumsum{…}}, ::Infinities.RealInfinity)
The function `findblock` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  findblock(::BlockArrays.AbstractBlockedUnitRange, ::Integer)
   @ BlockArrays C:\Users\djv23\.julia\packages\BlockArrays\VccC2\src\blockaxis.jl:407
  findblock(::AbstractUnitRange{<:Integer}, ::Integer)
   @ BlockArrays C:\Users\djv23\.julia\packages\BlockArrays\VccC2\src\blockaxis.jl:440

Stacktrace:
 [1] getindex(P::SphericalHarmonic{…}, xy::SphericalCoordinate{…}, jr::InfiniteArrays.InfStepRange{…})
   @ HarmonicOrthogonalPolynomials C:\Users\djv23\.julia\packages\HarmonicOrthogonalPolynomials\yHaVS\src\multivariateops.jl:38
 [2] top-level scope
   @ REPL[479]:1
Some type information was truncated. Use `show(err)` to see complete types.

The getindex method that is being used is

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

Any idea how to fix this? I tried looking into how other methods do it e.g. how 1:2:end is handled for semiclassical Jacobi polynomials, but all the getindex code buried in layout_getindex gets me confused fast. Not too urgent since I can get around it with view for now.

@dlfivefifty
Copy link
Member

dlfivefifty commented Nov 19, 2024

Probably we just need to overload findblock(::BlockedOneTo, ::RealInfinity) to return Block(ℵ₀) and change the Int call to Integer

@DanielVandH
Copy link
Member Author

DanielVandH commented Nov 19, 2024

I'll make a PR to BlockArrays (or where would this go?) for

findblock(::BlockedOneTo, ::RealInfinity) to return Block(ℵ₀)

and then update the Int call in this package.

@dlfivefifty
Copy link
Member

At the moment it would go in InfiniteLinearAlgebra.jl. In the future that package will be broken up into extensions in InfiniteArrays.jl at which point it would be in InfiniteArraysBlockArraysExt.jl

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 a pull request may close this issue.

2 participants