-
-
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
add --QuadratureFunction-- QuadratureRule #176
Conversation
docs/src/solvers/IntegralSolvers.md
Outdated
@@ -12,10 +12,12 @@ The following algorithms are available: | |||
- `CubaDivonne`: Divonne from Cuba.jl. Requires `using IntegralsCuba`. Works only for `>1`-dimensional integrations. | |||
- `CubaCuhre`: Cuhre from Cuba.jl. Requires `using IntegralsCuba`. Works only for `>1`-dimensional integrations. | |||
- `GaussLegendre`: Uses Gauss-Legendre quadrature with nodes and weights from FastGaussQuadrature.jl. | |||
- `QuadratureFunction`: Accepts a user-defined function that returns nodes and weights. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so sure of the naming on this, and also it sounds more like a function than an algorithm. Maybe GeneralQuadrature
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or QuadratureRule
, i.e. similar to TrapezoidalRule
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think GeneralQuadrature
would sound too similar to this work https://github.com/JoshuaTetzner/GeneralizedGaussianQuadrature.jl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a repo with 0 stars, I'm not worried about people knowing that. I'm more worried that people know ODEFunction
, SDEFunction
, NonlinearFunction
, BVPFunction
, etc. as a standard in SciML for the SciMLFunction interface https://docs.sciml.ai/SciMLBase/stable/interfaces/SciMLFunctions/, but here it's breaking the rule.
I think QuadratureRule
sounds good.
This looks great. Only some bikeshedding on the naming and I think this is good to go. |
Would it be good to also support vector-valued integrands? Right now you assert |
Thanks, I removed the check. |
I renamed to |
maxiters = nothing) | ||
prob = build_problem(cache) | ||
if isinplace(prob) | ||
error("QuadratureRule does not support inplace integrands.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason it doesn't? That seems like it should be possible. I guess open an issue on this as something to do later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know the element type of the output array to allocate. This will be fixed by the IntegralFunction PR
Hi,
This pr adds a
QuadratureFunction
algorithm that allows the user to pass in a function that returns nodes,x
, and weights,w
, and computessum(w .* f.(x))
. This could serve as a backend for other integration algorithms we would like to support, such as the trapezoidal rule and FastGaussQuadrature.jl rules.