Skip to main content

SphereWahbaKernel

Enum SphereWahbaKernel 

Source
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 of H^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 as l^{-(m+1)}, different from Sobolev’s l^{-2m}). Faster to evaluate (one elementary polynomial in sin(γ/2), log), and matches mgcv’s bs="sos" exactly. At m=4 the 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

§lmax: u16

Largest Legendre degree retained (≥ 1). Practical range 5..200; GPU kernel uses LMAX as a compile-time #define.

§

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.

Fields

§lmax: u16

Largest Legendre degree retained (≥ 1).

Trait Implementations§

Source§

impl Clone for SphereWahbaKernel

Source§

fn clone(&self) -> SphereWahbaKernel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for SphereWahbaKernel

Source§

impl Debug for SphereWahbaKernel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SphereWahbaKernel

Source§

fn default() -> SphereWahbaKernel

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SphereWahbaKernel

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for SphereWahbaKernel

Source§

impl PartialEq for SphereWahbaKernel

Source§

fn eq(&self, other: &SphereWahbaKernel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SphereWahbaKernel

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SphereWahbaKernel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Boilerplate for T
where T: Copy + Send + Sync + Debug + PartialEq + 'static,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V