pub enum SphereWahbaKernel {
Sobolev,
Pseudo,
SobolevTruncated {
lmax: u16,
},
PseudoTruncated {
lmax: u16,
},
}Expand description
Which reproducing kernel to use for SphereMethod::Wahba.
Both options yield positive-definite reproducing kernels on S² with
the same family of penalty_order m ∈ {1, 2, 3, 4}. They define
different RKHS, however:
-
Sobolev (default, more correct): true Wahba/Sobolev kernel
K_m(γ) = (1/4π) Σ_{l ≥ 1} (2l+1) · [l(l+1)]^{-m} · P_l(cos γ), the reproducing kernel ofH^m(S²)under the Laplace–Beltrami inner product. Penalty quadratic form recovers‖f‖²_{H^m} = Σ_l [l(l+1)]^m · |f̂_l|². For m=1, 2, 3 this is evaluated via the closed forms from Beatson & zu Castell (2018) “Thinplate Splines on the Sphere” (SIGMA 14 (2018), 083) using elementary functions plus the di/trilogarithm. For m=4 we fall back to the spectral Legendre series (96 terms ⇒ truncation error ≲ 1e-12). -
Pseudo: Wahba 1981’s “pseudo-spline” kernel with Legendre weights
2 / [(l+1)(l+2)···(l+m+1)](decaying asl^{-(m+1)}, different from Sobolev’sl^{-2m}). Faster to evaluate (one elementary polynomial insin(γ/2),log), and matches mgcv’sbs="sos"exactly. Atm=4the pseudo-spline produces numerically tiny kernel values (K(p,p) ≈ 3e-4) and the basis pipeline historically collapsed the smooth contribution to zero — the cure is the REML scale-invariance fix in the solver, not the kernel itself.
Default is Sobolev because it matches the canonical “Wahba
spline of order m on S²” interpretation. Use Pseudo for exact
mgcv compatibility.
Variants§
Sobolev
True Sobolev H^m(S²) reproducing kernel via closed-form
(elementary + Li_n) for m=1,2,3 and a deep (L=4096..96) spectral
series for m=4. This is the user-facing default.
Pseudo
Wahba 1981 closed-form pseudo-spline (mgcv bs="sos" compatible).
SobolevTruncated
Finite truncated-spectral Sobolev kernel evaluated by the same
Legendre 3-term recurrence the GPU s2_wahba_legendre_colmajor
kernel runs in registers:
K_L^{Sobolev}(γ) = Σ_{ℓ=1..L} c_ℓ · P_ℓ(cos γ),
c_0 = 0, c_ℓ = (2ℓ+1) / (4π · [ℓ(ℓ+1)]^m).
This is the explicit parity target for the GPU kernel: at any
finite lmax the closed-form (or m=4-spectral-at-fixed-deep-L)
variants differ by the documented truncation error, while the GPU
matches this variant exactly to roundoff. Single-source: both CPU
and GPU use the same Legendre recurrence and the same c_ℓ array.
Fields
PseudoTruncated
Finite truncated-spectral Wahba-1981 pseudo-spline kernel:
K_L^{Pseudo}(γ) = Σ_{ℓ=1..L} c_ℓ · P_ℓ(cos γ),
c_0 = 0, c_ℓ = 2 / (4π · Π_{k=1..m+1}(ℓ + k)).
Same role as Self::SobolevTruncated for the pseudo branch.
Trait Implementations§
Source§impl Clone for SphereWahbaKernel
impl Clone for SphereWahbaKernel
Source§fn clone(&self) -> SphereWahbaKernel
fn clone(&self) -> SphereWahbaKernel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SphereWahbaKernel
Source§impl Debug for SphereWahbaKernel
impl Debug for SphereWahbaKernel
Source§impl Default for SphereWahbaKernel
impl Default for SphereWahbaKernel
Source§fn default() -> SphereWahbaKernel
fn default() -> SphereWahbaKernel
Source§impl<'de> Deserialize<'de> for SphereWahbaKernel
impl<'de> Deserialize<'de> for SphereWahbaKernel
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SphereWahbaKernel
Source§impl PartialEq for SphereWahbaKernel
impl PartialEq for SphereWahbaKernel
Source§fn eq(&self, other: &SphereWahbaKernel) -> bool
fn eq(&self, other: &SphereWahbaKernel) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for SphereWahbaKernel
impl Serialize for SphereWahbaKernel
impl StructuralPartialEq for SphereWahbaKernel
Auto Trait Implementations§
impl Freeze for SphereWahbaKernel
impl RefUnwindSafe for SphereWahbaKernel
impl Send for SphereWahbaKernel
impl Sync for SphereWahbaKernel
impl Unpin for SphereWahbaKernel
impl UnsafeUnpin for SphereWahbaKernel
impl UnwindSafe for SphereWahbaKernel
Blanket Implementations§
impl<T> Allocation for T
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.