Skip to main content

gam_terms/basis/
mod.rs

1//! Spline / spatial / spherical basis construction, penalties, and the
2//! hyperparameter (`ψ`) derivative machinery that the smooth terms build on.
3//!
4//! The module is decomposed into single-concern submodules. Shared crate
5//! imports live in [`prelude.rs`](prelude.rs) and are pulled into this module's
6//! namespace; every submodule re-imports them (together with the sibling
7//! re-exports below) through `use super::*`. The `pub use <module>::*`
8//! re-exports flatten each concern back onto the `basis::` path so external
9//! callers keep referring to e.g. `basis::CenterStrategy` regardless of which
10//! submodule now owns the item.
11
12// Crate-wide imports, shared by every submodule via `use super::*`.
13include!("prelude.rs");
14
15// ---- Manifold / geometric smooth specifications and kernels ----
16mod constant_curvature_smooth;
17mod cyclic;
18mod sphere_kernels;
19mod sphere_spec;
20mod sphere_spectral;
21
22// ---- Measure-jet smooth (V0 / V∞) ----
23mod measure_jet_anisotropy;
24mod measure_jet_moments;
25mod measure_jet_predict;
26mod measure_jet_smooth;
27
28// ---- Scalar math primitives ----
29mod polylog;
30
31// ---- Core types, evaluation, planning, and the (ψ) derivative engine ----
32mod bspline_build;
33mod bspline_eval;
34mod center_selection;
35pub mod closed_form_operator;
36mod cubic_regression;
37mod duchon_kernel_math;
38mod duchon_psi_derivatives;
39mod duchon_thinplate;
40mod implicit_psi_derivative;
41pub mod input_loc_derivatives;
42mod internal;
43pub mod matern_gradient;
44mod matern_kernel;
45mod periodic_duchon;
46mod radial_jets_nd;
47mod sphere_basis;
48pub mod sphere_gpu;
49mod spline_eval_scalar;
50mod streaming_design;
51mod types;
52mod workspace_cache;
53
54/// Closed-form scalar building blocks for Riesz, Matérn, and isotropic
55/// hybrid Duchon kernels.
56///
57/// Fourier convention: f̂(ω) = ∫ e^{-iω·x} f(x) dx,
58/// f(x) = (2π)^{-d} ∫ e^{iω·x} f̂(ω) dω.
59///
60/// Riesz kernel:  R_j^d(r) = F^{-1}{|ρ|^{-2j}}(r).
61/// Matérn block:  M_ℓ^d(r; κ) = F^{-1}{(|ρ|² + κ²)^{-ℓ}}(r).
62pub mod closed_form_penalty;
63
64pub mod radial_profile;
65
66// ---- Flat re-exports: preserve the external `basis::X` path surface ----
67
68pub use constant_curvature_smooth::{
69    ConstantCurvatureBasisSpec, ConstantCurvatureIdentifiability, build_constant_curvature_basis,
70    build_constant_curvature_basis_kappa_derivatives, constant_curvature_effective_length,
71    constant_curvature_honest_profiled_reml_score, constant_curvature_kappa_fair_sign_score,
72    constant_curvature_kernel_kappa_jets, constant_curvature_kernel_matrix,
73    realized_constant_curvature_length_scale,
74};
75
76pub use measure_jet_moments::{
77    MeasureJetJetStats, MeasureJetMomentTable, accumulate_moment_table, jet_sufficient_stats,
78    merge_moment_tables, recenter_moment_table,
79};
80
81pub use measure_jet_predict::{
82    MeasureJetExtrapolationSpectrum, measure_jet_extrapolation_variance,
83};
84
85pub use measure_jet_smooth::{
86    MeasureJetBand, MeasureJetBasisSpec, MeasureJetEnergyJets, MeasureJetFrozenQuadrature,
87    MeasureJetIdentifiability, build_measure_jet_basis, build_measure_jet_basis_psi_derivatives,
88    measure_jet_band, measure_jet_center_masses, measure_jet_design_matrix,
89    measure_jet_energy_form, measure_jet_energy_form_with_jets, measure_jet_energy_forms_per_scale,
90    measure_jet_multiscale_mode, measure_jet_quadrature_nodes, measure_jet_scale_spectrum,
91    measure_jet_support_curve, realized_measure_jet_length_scale,
92};
93
94pub use measure_jet_anisotropy::{
95    LIndex, MeasureJetAnisotropyJets, lower_triangular_indices, measure_jet_anisotropy_energy_form,
96    measure_jet_anisotropy_energy_form_with_jets,
97};
98
99pub use sphere_spec::{
100    SphereMethod, SphereWahbaKernel, SphericalSplineBasisSpec, SphericalSplineIdentifiability,
101};
102
103pub use cyclic::{
104    create_closure_difference_penalty_jet, create_cyclic_difference_penalty_matrix,
105    create_open_difference_penalty_matrix,
106};
107
108pub(crate) use cyclic::{
109    create_cyclic_bspline_basis_dense, cyclic_distance_1d, cyclic_uniform_knot_vector,
110    wrap_to_period,
111};
112
113// Concern modules: flatten each onto `basis::` so external paths are unchanged.
114pub use bspline_build::*;
115pub use bspline_eval::*;
116pub use center_selection::*;
117pub use closed_form_operator::ClosedFormPenaltyOperator;
118pub use cubic_regression::*;
119pub use duchon_kernel_math::*;
120pub use duchon_psi_derivatives::*;
121pub use duchon_thinplate::*;
122pub use implicit_psi_derivative::*;
123pub use matern_kernel::*;
124pub use periodic_duchon::*;
125pub use radial_jets_nd::*;
126pub use sphere_basis::*;
127pub use spline_eval_scalar::*;
128pub use streaming_design::*;
129pub use types::*;
130pub use workspace_cache::*;
131
132#[cfg(test)]
133mod tests;