torchquad
torchquad copied to clipboard
Adaptive trapezoid
Description
Summary of changes
- Added adaptive_trapezoid
- Added adaptive_grid
Outstanding work
- [x] Create some test functions to see if this is working (or use existing ones)
- [x] Debug the tests (currently errors are noticeably larger than for default trapezoid which does not make sense)
- [x] Optimize: There are several TODOs in the code for this (reusing computed points, allocating memory in a smarter way)
- [ ] Choose good baseline values for N_subdomains and initial N in each subdomain
- [ ] Add more logging (currently only debug in some places)
- [x] Create some code to visualize the created adaptive grids. This should help also with debugging.
- [ ] Improve refinement criterion
- [ ] Optimize for larger number of subdomains
There are a few larger topics still open then, but these probably deserve dedicated issues and PRs
- [x] Creating AdaptiveBoole and AdaptiveSimpson (should be fairly straight forward)
- Make the refinement not refine in all dimension equally, this is closely related to #123
- Implement batched grid computations to allow larger N without having out of memory problems
Above points should help remedy some of the issues, right now performance on a simple integrand (f = torch.sin(x[:,0] + (x[:,1]+1.)**2) * (x[:,2]+1.)
) is worse than for vanilla trapezoid, but that is somewhat expected.
How Has This Been Tested?
- [ x ] Added new test