Internal numerical contracts#
SplineOps keeps its public modules independent. Internal reuse is accepted only when the participating algorithms have the same mathematical contract; similar vocabulary is not enough. This page records those decisions so that future cleanup does not silently change results.
Compatibility matrix#
Primitive |
Current consumers |
Reuse decision |
Reason |
|---|---|---|---|
Cubic mirror prefilter |
|
Shared implementation |
Both require cardinal cubic coefficients on a whole-sample mirror extension. Differentials uses the batched last-axis implementation and independently applies derivative filters. |
Basis evaluation |
|
Partly shared |
Affine evaluates through |
Boundary mapping |
Interpolation, resize, pyramids |
Not unified |
Mirror names do not imply identical reflection centers, sample grids, or projection behavior. Each public contract keeps its own mapping. |
Coordinate generation |
|
Shared policy, separate geometry |
Evaluation is tiled to bound temporaries. Affine pull-back coordinates and endpoint-aligned resize coordinates are purpose-specific. |
Array backend detection |
|
Centralized inside interpolation |
NumPy is the package-wide backend. CuPy remains experimental and must not leak into modules that have no GPU contract. |
Plan/cache objects |
Resize, |
Separate public concepts |
|
Array-role contract#
batch and channel are roles assigned by a public API, not inferred from
array rank:
Module |
Spatial axes |
Batch/channel behavior |
|---|---|---|
Resize |
Explicit |
Unselected axes are preserved exactly. |
Affine |
Exactly two or three |
Remaining slices are mathematically independent and share one batched prefilter/support contraction with memory-bounded query tiles. Tagged persistence is atomic numeric-plus-JSON data, not object serialization. |
|
Every construction-data axis is a spline dimension |
Query coordinates may be batched; sample-value channel axes are not inferred. |
Smoothing |
Explicit |
Unselected batch/channel slices share one batched real-FFT execution. |
Differentials |
Two or three explicit |
Remaining slices are mathematically independent but execute through one
batched coefficient/derivative workspace; the legacy |
Multiscale |
Two explicit |
Small planes use cache-sized vectorized groups; cache-filling planes are dispatched directly to avoid full-array transpose copies. Axes are never inferred from rank. |