Skip to main content Module basis Copy item path Source closed_form_penalty Closed-form scalar building blocks for Riesz, Matérn, and isotropic
hybrid Duchon kernels. AnisoBasisPsiDerivatives Per-axis psi_a derivative package for anisotropic spatial terms. AnisoPenaltyCrossProvider BSplineBasisSpec 1D B-spline basis configuration. BasisBuildResult Standardized basis build result for engine-level composition. BasisOptions Options for basis generation, controlling derivative order. BasisPsiDerivativeBundle BasisPsiDerivativeResult BasisPsiSecondDerivativeResult BasisWorkspace Explicit per-run workspace for reusable basis-construction caches. CanonicalPenaltyBlock CollocationOperatorMatrices Dense Marker type for dense basis matrix output. DuchonBasisSpec Duchon-like basis configuration with explicit low-frequency null-space
control and explicit spectral power. DuchonOperatorPenaltySpec DuchonSplineBasis Duchon radial basis with triple operator regularization and explicit
low-frequency null-space order. The penalty blocks are collocation
operator Gram matrices, not the native spectral Duchon seminorm. ImplicitDesignPsiDerivative Implicit representation of ∂X/∂ψ_d that supports matrix-vector products
without materializing the full (n x p) derivative matrices. KroneckerFactoredBasis Factored tensor-product basis metadata for operator-backed downstream use. MaternBasisSpec Matérn basis configuration. MaternSplineBasis Matérn radial basis and penalties. PenaltyCandidate PenaltyInfo Sparse Marker type for sparse basis matrix output. SpatialBasisPlan Resource-aware plan for a spatial smooth (Duchon / Matérn / TPS). SplineScratch Scratch memory for B-spline evaluation to avoid allocations in tight loops. ThinPlateBasisSpec Thin-plate basis configuration. ThinPlateSplineBasis Thin-plate regression spline basis and penalty (order m=2). BSplineIdentifiability Per-smooth identifiability policy for 1D B-spline bases. BSplineKnotPlacement Internal-knot placement strategy when knots are automatically inferred. BSplineKnotSpec Which knot strategy to use for 1D B-spline bases. BasisError A comprehensive error type for all operations within the basis module. BasisEvalKind BasisFamily Basis-family selector for 1D spline evaluation. BasisMetadata Metadata returned by generic basis builders. CenterCountRequest How plan_spatial_basis should pick the spatial center count. CenterStrategy Spatial center selection strategy. CenterStrategyKind DuchonNullspaceOrder Duchon null-space polynomial degree.
0 keeps the constant null space (m=1), 1 keeps
[1, x_1, ..., x_d] (m=2), and Degree(k) keeps all monomials
with total degree <= k. KnotSource Specifies the source of knots for basis generation. MaternIdentifiability Per-smooth identifiability policy for Matérn kernel coefficients. MaternNu Matérn smoothness parameter nu (half-integer variants with closed forms). OperatorPenaltySpec PenaltyDropReason PenaltySource SpatialIdentifiability Per-smooth identifiability policy for spatial (TPS / Duchon) bases. SpatialStorageMode Storage mode recommended by plan_spatial_basis . BasisOutput Trait for selecting basis storage format at compile time. BasisOutputFormat Trait for building basis matrices with different storage formats.
This is an implementation detail for the unified create_basis function. analyze_penalty_block analyze_penalty_block_with_op apply_linear_extension_from_first_derivative Applies first-order linear extension outside a knot-domain interval to a basis matrix
that was evaluated at clamped coordinates. apply_sum_to_zero_constraint Applies a sum-to-zero constraint to a basis matrix for model identifiability. apply_sum_to_zero_constraint_sparse applyweighted_orthogonality_constraint Reparameterizes a basis matrix so its columns are orthogonal (with optional weights)
to a supplied constraint matrix. assert_no_dense_derivative_materialization assert_spatial_centers_below_biobank_cap auto_spatial_center_strategy build_bspline_basis_1d Generic 1D B-spline builder returning design + penalty list. build_duchon_basis Generic Duchon builder returning design + penalty list. build_duchon_basis_log_kappa_aniso_derivatives Build per-axis ψ_a derivatives for anisotropic Duchon terms, including
both design-matrix and penalty derivatives. build_duchon_basis_log_kappa_derivative build_duchon_basis_log_kappa_derivatives build_duchon_basis_log_kappa_derivativeswithworkspace build_duchon_basis_log_kappa_derivativewithworkspace build_duchon_basis_log_kappasecond_derivative build_duchon_basis_log_kappasecond_derivativewithworkspace build_duchon_basiswithworkspace build_duchon_collocation_operator_matrices build_duchon_collocation_operator_matriceswithworkspace build_matern_basis Generic Matérn builder returning design + penalty list. build_matern_basis_log_kappa_aniso_derivatives Build per-axis ψ_a derivatives for anisotropic Matérn terms, including
both design-matrix and penalty derivatives. build_matern_basis_log_kappa_derivative build_matern_basis_log_kappa_derivatives build_matern_basis_log_kappa_derivativeswithworkspace build_matern_basis_log_kappa_derivativewithworkspace build_matern_basis_log_kappasecond_derivative build_matern_basis_log_kappasecond_derivativewithworkspace build_matern_basiswithworkspace build_matern_collocation_operator_matrices build_thin_plate_basis Generic thin-plate builder returning design + penalty list. build_thin_plate_basis_log_kappa_derivative build_thin_plate_basis_log_kappa_derivatives build_thin_plate_basis_log_kappa_derivativeswithworkspace build_thin_plate_basis_log_kappa_derivativewithworkspace build_thin_plate_basis_log_kappasecond_derivative build_thin_plate_basis_log_kappasecond_derivativewithworkspace build_thin_plate_basiswithworkspace center_strategy_is_auto center_strategy_kind center_strategy_num_centers center_strategy_with_num_centers closed_form_aniso_psi_derivatives_in_total_basis Closed-form anisotropic penalty S_q and its raw-η derivatives — full
d×d Hessian materialized — in the final (post-transform) basis space.
Returns (S_q, S_q_eta_a per axis, S_q_eta_a_a per axis, S_q_eta_a_b for (a, b) with a < b). All derivatives are with respect to raw η components
directly per math team Letter A §9 — no centering, no apply_raw_psi_scaling. closed_form_anisotropic_pair_block closed_form_anisotropic_pair_block_pure Pure-Duchon (κ=0) variant of closed_form_anisotropic_pair_block . closed_form_matern_pair_block Closed-form pair-block penalty for the pure Matérn basis at operator order
q ∈ {0, 1, 2}. closed_form_operator_penalty_in_total_basis closed_form_operator_penalty_in_total_basis_pure Pure-Duchon (κ=0 / length_scale = None) counterpart of
closed_form_operator_penalty_in_total_basis . Uses
closed_form_anisotropic_pair_block_pure to evaluate the closed-form
penalty via analytic radial derivatives of the pure-Riesz kernel, which
is finite for R > 0 in any (m, s, d, q) regime where
radial_derivatives_of_isotropic_duchon is defined. Self-pair (R=0)
regularization is handled inside the pair-block routine. closed_form_psi_derivatives_in_total_basis Closed-form penalty value S_q and its log-κ derivatives S_q_psi,
S_q_psi_psi in the final (post-transform) basis space, computed via
pair_block_radial_with_j_second_derivatives from the closed_form_penalty
module. Bundle’s d_kappa and d2_kappa are κ-derivatives; chain rule
converts to log-κ: ∂/∂ψ = κ·∂/∂κ,
∂²/∂ψ² = κ²·∂²/∂κ² + κ·∂/∂κ. closed_form_thin_plate_pair_block Closed-form pair-block penalty for the thin-plate spline (TPS) basis. compute_geometric_constraint_transform Compute the constraint transform Z using Greville abscissae (geometric constraints). compute_greville_abscissae Compute Greville abscissae for a B-spline basis. create_basis Unified B-spline basis generation with configurable storage, knot source, and options. create_difference_penalty_matrix Creates a penalty matrix S for a B-spline basis from a difference matrix D.
The penalty is of the form S = D' * D, penalizing the squared order-th
differences of the spline coefficients. This is the core of P-splines. create_duchon_spline_basis Creates a Duchon radial basis whose kernel is derived from
P(w) = ||w||^(2p) * (kappa^2 + ||w||^2)^s
using: create_duchon_spline_basiswithworkspace create_ispline_derivative_dense Compute the k-th derivative of an I-spline basis as a dense matrix. create_matern_spline_basiswithworkspace Creates a Matérn spline basis from data and centers. create_thin_plate_spline_basis Creates a thin-plate regression spline basis from data and knot locations. create_thin_plate_spline_basis_with_knot_count High-level TPS constructor: selects knots from data, then builds basis+penalty. create_thin_plate_spline_basis_with_knot_count_andworkspace create_thin_plate_spline_basiswithworkspace default_num_centers Adaptive default center count for spatial smooths (TPS, Duchon, Matérn). default_spatial_center_strategy duchon_max_active_operator_derivative_order Returns the maximum derivative order required by the active operator
penalties: 2 if stiffness is Active, else 1 if tension is Active, else 0.
Mass-only (or no active operator) penalties only require kernel validity
(2(p+s) > d), tension requires D1 collocation (2(p+s) > d+1), and
stiffness requires D2 collocation (2(p+s) > d+2). duchon_nullspace_dimension evaluate_bspline_basis_scalar Evaluates B-spline basis functions at a single scalar point x into a provided buffer. evaluate_bspline_derivative_scalar Evaluates B-spline basis derivatives at a single scalar point x into a provided buffer. evaluate_bspline_derivative_scalar_into Zero-allocation version: pass pre-allocated buffers for lower_basis and scratch. evaluate_bspline_fourth_derivative_scalar Evaluates B-spline fourth derivatives at a single scalar point x into a provided buffer. evaluate_bspline_fourth_derivative_scalar_into Zero-allocation version for fourth derivatives: pass pre-allocated buffers. evaluate_bsplinesecond_derivative_scalar Evaluates B-spline second derivatives at a single scalar point x into a provided buffer. evaluate_bsplinesecond_derivative_scalar_into Zero-allocation version for second derivatives: pass pre-allocated buffers. evaluate_bsplinethird_derivative_scalar Evaluates B-spline third derivatives at a single scalar point x into a provided buffer. evaluate_bsplinethird_derivative_scalar_into Zero-allocation version for third derivatives: pass pre-allocated buffers. evaluate_ispline_scalar evaluate_ispline_scalarwith_scratch Evaluates I-spline basis functions at a scalar point x into a provided buffer. evaluate_mspline_scalar Evaluates M-spline basis functions at a scalar point x into a provided buffer. filter_active_penalty_candidates filter_active_penalty_candidates_with_ops Same filtering pass as filter_active_penalty_candidates but also
returns the per-active-penalty operator handles when the originating
PenaltyCandidate.op was populated. The ops vector is parallel to the
penalties vector (same length, same order). Each entry is Some(op)
when the candidate carried an operator-form handle bit-equivalent to its
dense matrix, and None for ordinary dense penalties. Consumers in the
PIRLS/REML pipeline that want operator-form matvec for PCG-against-
implicit-H call this and route through the Some entries. initial_aniso_contrasts Compute initial anisotropy contrasts η_a from knot center geometry. knot_cloud_axis_scales Compute per-axis standard deviations of knot center coordinates. minimum_duchon_power_for_operator_penalties operator_penalty_candidates_closed_form operator_penalty_candidates_closed_form_pure Pure-Duchon (κ=0 / length_scale = None) counterpart of
operator_penalty_candidates_closed_form . penalty_greville_abscissae_for_knots Selects Greville abscissae for difference-penalty scaling when knot geometry is non-uniform. plan_spatial_basis Build a resource-aware plan for a spatial smooth basis. resolve_duchon_orders Resolve a fully admissible Duchon (nullspace_order, power) pair. select_centers_by_strategy select_thin_plate_knots Deterministically selects thin-plate knots via farthest-point sampling. should_use_implicit_operators_with_policy Determine whether implicit operators should be used based on problem size
and the supplied [ResourcePolicy]. should_use_sparse_basis Returns true if the B-spline basis should be built in sparse form based on density. thin_plate_polynomial_basis_dimension