Struct options
Defined in File treeweave.hpp
Struct Documentation
-
struct options
Runtime fit knobs. A value-initialised
options{}is the default: a zero numeric field means auto, anddetail::init_defaultssets its value. Every field here only affects fit-time construction; there is no eval-time benefit to promoting any of them to a template parameter, so they stay plain data.Public Members
-
TolKind tol_kind = TolKind::RelativeMax
How the convergence check interprets
tol. The default (RelativeMax) compares the max-abs error on an 8^dim cell-centred sample grid per panel againsttoltimes the largest|f|sampled over the whole domain, so zeros offare fine.
-
int max_depth = 0
Tree-depth ceiling for the adaptive paneler. Hitting it without converging throws
MaxDepthExceeded(or, withallow_max_depth_leaves, accepts the panel as best-effort).0(default): auto, 50. That is far above what any non-singular function needs; lower it to fail fast near a suspected singularity.< 0: no subdivision, the root panel only.> 0: explicit ceiling.
-
int max_memory_mib = 0
Hard cap on accumulated leaf storage during the fit, in MiB. Tri-state:
0(default): auto.detail::init_defaultssets a dimension-scaled budget,4 << 3*(input_dim-1)MiB (4 / 32 / 256 for 1D / 2D / 3D). Leaf storage grows ~geometrically withinput_dim, so one flat cap is too loose in 1D or too tight in 3D.< 0: disabled (no cap).> 0: explicit cap in MiB. The default is deliberately small so an adaptive paneler can’t quietly grow into hundreds of MiB; ambitious 3D+ or oscillatory fits opt in explicitly with a larger value (or0). Crossing the cap throwsMemoryBudgetExceeded, which carries the used/budget bytes and the offending panel so the caller can raise the budget or excise the singular region.
-
bool allow_max_depth_leaves = false
When true, panels that fail tolerance at
max_depthare kept as best-effort leaves. Inspect them viaFunction::non_converged_panels(). Default false (throw, with the panel list attached on the exception).
-
int min_uniform_depth = 0
Force BFS to refine every panel to at least this depth before the per-panel tolerance test exits. Useful for driving the leaf-table fast path (
PolyTree::quantize_one): a uniformly- refined tree of depth D in input_dim K builds a 2^(K*D)-entry quantize table the eval-time lookup collapses to one SIMD quantize + one u32 load. Table size grows as 2^(K*D) * 4 B and is capped at 64 K entries (256 KiB) per subtree, so values that push pastK*D > 16will still build a uniform tree but not the table. Default 0: no forcing, tol-based refinement only.
-
std::optional<std::string> filename = std::nullopt
Path of a plain-text fit file.
std::nullopt(default): no file. Elsefitloads the fit from the file when the file exists and was written by the same treeweave and polyfit versions for the same value type, dimensions, degree, domain,toland options. Otherwisefitruns the fit and writes the file. The file keeps the coefficient digits thattolneeds: for RelativeMax and the absolute kinds a load moves the fit by at most tol * S / 10 (S = max|f|, or 1); the other kinds keep every digit. The file does not identify the function: a file written for another function with the same arguments loads without an error.
-
TolKind tol_kind = TolKind::RelativeMax