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

gausshermite(21) returns error #105

Closed
the-noble-argon opened this issue Nov 25, 2021 · 4 comments
Closed

gausshermite(21) returns error #105

the-noble-argon opened this issue Nov 25, 2021 · 4 comments

Comments

@the-noble-argon
Copy link

the-noble-argon commented Nov 25, 2021

gausshermite(20) works, gausshermite(22) works, it appears 21 is the unlucky number:

ERROR: BoundsError: attempt to access 10-element Vector{Float64} at index [11]
Stacktrace:
[1] setindex!
@ .\array.jl:839 [inlined]
[2] setindex!
@ .\array.jl:853 [inlined]
[3] hermite_initialguess(n::Int64)
@ FastGaussQuadrature C:\Users.julia\packages\FastGaussQuadrature\WqyQC\src\gausshermite.jl:271
[4] hermite_rec(n::Int64)
@ FastGaussQuadrature C:\Users.julia\packages\FastGaussQuadrature\WqyQC\src\gausshermite.jl:86
[5] unweightedgausshermite(n::Int64)
@ FastGaussQuadrature C:\Users.julia\packages\FastGaussQuadrature\WqyQC\src\gausshermite.jl:41
[6] gausshermite(n::Int64)
@ FastGaussQuadrature C:\Users.julia\packages\FastGaussQuadrature\WqyQC\src\gausshermite.jl:23
[7] top-level scope
@ REPL[7]:1

@hyrodium
Copy link
Collaborator

This bug was introduced in release v0.4.8.

julia> using FastGaussQuadrature  # On v0.4.8

julia> gausshermite(21)
ERROR: BoundsError: attempt to access 10-element Vector{Float64} at index [11]
Stacktrace:
 [1] setindex!
   @ ./array.jl:843 [inlined]
 [2] setindex!
   @ ./array.jl:857 [inlined]
 [3] hermite_initialguess(n::Int64)
   @ FastGaussQuadrature ~/.julia/dev/FastGaussQuadrature/src/gausshermite.jl:271
 [4] hermite_rec(n::Int64)
   @ FastGaussQuadrature ~/.julia/dev/FastGaussQuadrature/src/gausshermite.jl:86
 [5] unweightedgausshermite(n::Int64)
   @ FastGaussQuadrature ~/.julia/dev/FastGaussQuadrature/src/gausshermite.jl:41
 [6] gausshermite(n::Int64)
   @ FastGaussQuadrature ~/.julia/dev/FastGaussQuadrature/src/gausshermite.jl:23
 [7] top-level scope
   @ REPL[2]:1
julia> using FastGaussQuadrature  # On v0.4.7

julia> gausshermite(21)
([-5.550351873264678, -4.773992343411219, -4.1219955474918395, -3.5319728771376777, -2.979991207704598, -2.453552124512838, -1.9449629491862535, -1.448934250650732, -0.9614996344183689, -0.4794507070791075    0.4794507070791075, 0.9614996344183689, 1.448934250650732, 1.9449629491862535, 2.453552124512838, 2.979991207704598, 3.5319728771376777, 4.1219955474918395, 4.773992343411219, 5.550351873264678], [3.7203650688183795e-14, 8.818611242049893e-11, 2.5712301800593306e-8, 2.1718848980566762e-6, 7.478398867310059e-5, 0.0012549820417264083, 0.011414065837434388, 0.060179646658912324, 0.1921203240669979, 0.381669073613502    0.381669073613502, 0.1921203240669979, 0.060179646658912324, 0.011414065837434388, 0.0012549820417264083, 7.478398867310059e-5, 2.1718848980566762e-6, 2.5712301800593306e-8, 8.818611242049893e-11, 3.7203650688183795e-14])

@hyrodium
Copy link
Collaborator

Thanks for the bug report! I made a PR to fix this bug.

@bvdmitri
Copy link

Thanks for the fast fix! Could you please be so kind to tag a new release with new fix?

This bug breaks our package for Bayesian inference on precompilation stage, because apparently we used 21 number of points as a default value 😅😅.

https://github.com/biaslab/ReactiveMP.jl/blob/77d9fae7d9466d92e63731d89ac086c2e15905b4/src/nodes/gcv.jl#L17

@dlfivefifty
Copy link
Member

done!

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

No branches or pull requests

4 participants