-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Broken inplace integrand for HCubatureJL #169
Comments
Yes, I think a breaking change is needed to fix this. |
I think that's a good suggestion. |
Perhaps a combination of wrappers like |
Batch integrands could work similarly to how they will in QuadGK.jl after this PR gets merged JuliaMath/QuadGK.jl#80 |
SciML PR SciML/SciMLBase.jl#497 |
Now that the SciMLBase PR has merged, Integrals.jl only supports SciMLBase v1 right now because the integrand interface is the v2 breaking change. This is the issue that has to be solved for the bump to v2 to occur. |
Yep, I'm working on a pr for it, but I have to change most of the library since scimlbase v2 breaks all the features. I also have to make a PR to scimlbase and I'll try to wrap them up today |
Fixed by new interface 🎉 🎉 🎉 🎉 🎉 |
Hi,
I was writing a quadrature code with inplace integrands and I noticed that Integrals.jl has the same problem I noticed. Depending on how the quadrature library allocates arrays, it is possible that multiple integrand evaluations are made before they are summed together. When the result is overwritten to the same array this means some of the quadrature nodes are overwritten by the values of another. For example, integrating
sin(x)
on[-1,1]
as below should give zero on the initial segment, but the inplace evaluator seems to integratesin(abs(x))
on that segment.The problem is in the definition of the integrand wrapper
An issue with
dx
is that it may have the wrong type, since the user's function could return complex values at real nodes, for example. A fix is to allow the user to pass in the output array. The second issue in the example above can be fixed by returning a new array at each integrand evaluation, which can be done by returningone(eltype(lb))*dx
. The downside to this last fix is that most of the array operations aren't inplace, but the only way to achieve this is if the library supports them (e.g. seequadgk!
in QuadGK.jl for an implementation).The text was updated successfully, but these errors were encountered: