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

Regression with [email protected] #89

Closed
sathvikbhagavan opened this issue Sep 23, 2023 · 6 comments · Fixed by #90
Closed

Regression with [email protected] #89

sathvikbhagavan opened this issue Sep 23, 2023 · 6 comments · Fixed by #90

Comments

@sathvikbhagavan
Copy link

An issue was caught in SciML/DataInterpolations.jl#178 where tests started failing with [email protected]

I have made a MWE to illustrate the issue (using a simple LinearInterpolation from DataInterpolations):

u = collect(0:10)
t = collect(0:10)
A = LinearInterpolation(u,t)
qint, err = quadgk(A, 0.0, 10.0)

It is a straight line with slope 1. So the integral should be 50.0.

image

with [email protected]

julia> qint, err = quadgk(A, 0.0, 10.0)
(50.0, 0.0)

with [email protected]

julia> qint, err = quadgk(A, 0.0, 10.0)
(51.76911234248546, 4.274582013885939)
@stevengj
Copy link
Member

cc @lxvm

@stevengj
Copy link
Member

Seems to be a dispatch problem, since passing the argument as a function works:

julia> quadgk(A, 0.0, 10.0)
(51.76911234248546, 4.274582013885939)

julia> quadgk(t -> A(t), 0.0, 10.0)
(50.0, 0.0)

@stevengj
Copy link
Member

Okay, the problem is that LinearInterpolation is a subtype of AbstractVector, so it is calling the wrong method of QuadGK.evalrule.

@lxvm
Copy link
Contributor

lxvm commented Sep 23, 2023

Right, I can rename evalrule(::AbstractVector,...) to batchevalrule to fix the issue

@stevengj
Copy link
Member

Should be fixed by #90. Will merge and tag when green.

@lxvm
Copy link
Contributor

lxvm commented Sep 23, 2023

Thanks!

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.

3 participants