Architecture#
Package layout#
Module |
Contents |
|---|---|
|
|
|
|
|
The two solvers; they differ in how a split or merged subinterval gets its nodes |
|
The memory benchmark and the batch-size budget |
|
|
|
|
|
|
|
Device selection and multi-process setup |
|
Test integrands with known integrals |
Methods#
Every method is an instance of one of two classes built from data:
UniformMethodClass (fixed node fractions and weights) or
VariableMethodClass (node fractions and a function that computes the weights
from the node positions). Both implement the interface of the abstract
MethodClass: node_fractions(), weights(nodes), degree, order and
error_exponent. The solver reaches a method only through this interface, so a
new method needs no solver change. Each solver works on its own copy of its
method (MethodClass.clone()), so changing one solver’s precision never
changes the registries.
The integration loop#
Starting mesh. Without a given
mesh, the domain is cut into about \(\sqrt{N_\text{init}}\) equal pieces, each split again at random points, for aboutN_init_stepssubintervals (The starting mesh).Batches. Subintervals that still need evaluating are taken in batches that fit in memory. All their nodes are stacked into one tensor and the integrand is called once per batch.
Accept or split. Each subinterval’s error estimate is compared with its tolerance (Tolerances and error ratios). Accepted subintervals are recorded; the others are split in half and go back into the queue.
Gradients. With
take_gradient=True, each batch’s contribution is back-propagated as soon as it is accepted, so the autograd graph of the whole integral is never held at once (Gradients).Optimal mesh. After convergence, neighbouring subintervals whose combined error is small are merged and the result is stored as
mesh_optimal, the starting mesh of the next warm-started call (The optimal mesh and the merge rule).