Comments (7)
I think to keep generality, the in-place one uses in-place operations and leaves the other one alone.
Yes, but it would be good to refactor so that they can share as much code as possible. I'd hate to see the entire current implementation copy-pasted and then modified.
from quadgk.jl.
Sounds good to me. I'm not entirely sure of the API for passing f!
, though. quadgk!
, since presumably you'd also want to pass a pre-allocated result array?
Some tricky refactoring might be required to keep the current generality (since not all types support things like .+=
) while allowing in-place operations with preallocated arrays where possible.
One approach would be to internally wrap f!
in an InplaceIntegrand
functor type and dispatch on that, so that we can pass it through do_quadgk
etcetera, and then add various methods foo(f, ...)
which use the current behavior for generic f
and an optimized in-place behavior for f::InplaceIntegrand
.
from quadgk.jl.
I think it would be quadgk!
with a pre-allocated result array. I think to keep generality, the in-place one uses in-place operations and leaves the other one alone. quadgk
would then be good for scalars and static arrays (so no broadcasting internally), while quadgk!
would be more optimized for types which mutate and broadcast. Broadcast is almost a superset of indexable since GPUArrays and things like that are types which broadcast well but don't really index (they now have a fallback to avoid).
I would also like to have options to pass in the work vectors, much like it's done in the differentiation libraries, so I can avoid it allocating those each time. Or some kind of config/plan type that is made once and re-use.
from quadgk.jl.
Has there been any progress on this? Came over this issue when using quadgk in multithreaded loops on Intel KNL cpus, as the allocation made by the integrand severly limits proper scaling.
from quadgk.jl.
No, no one has worked on this yet.
from quadgk.jl.
Note that for integrating small vector integrands, you can use SVector
from StaticArrays.jl and it will be fast. See also this discussion on discourse.
from quadgk.jl.
I just pushed a PR to address this issue.
Note that it still cannot operate entirely in-place, because the QuadGK algorithm must dynamically allocate a heap data structure containing integration results on subintervals determined from error estimation.
from quadgk.jl.
Related Issues (20)
- Quadrature points and weights in the intervals [0, Inf] and [-Inf, +Inf] HOT 2
- Documentation suggestion
- TagBot trigger issue HOT 13
- AD compatibility HOT 1
- How to cite QuadGK HOT 1
- Compatibility with CUDA.jl HOT 2
- Possible regression using quadgk function and Unitful limits HOT 9
- unitful infinite bounds
- order=1 seems børked HOT 1
- contour integration HOT 1
- documentation build is failing HOT 4
- Autodiff of `quadgk` HOT 2
- Can not catch a JuliaError caused by function blowing up to infinity HOT 2
- misleading error estimate for non-convergent integral (maxevals=10^7 reached) HOT 5
- QuadGK evaluates function at upper bound HOT 4
- No cachedrule for DynamicQuantities types HOT 4
- Regression with [email protected] HOT 6
- spurious underflow in kronrod for large n HOT 1
- infinite limits with units and segbuf broken
- quadgk with identical lower and upper bound is broken HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quadgk.jl.