Skip to main content

SmoothCollectionGauge

Struct SmoothCollectionGauge 

Source
pub struct SmoothCollectionGauge {
    pub arm: SmoothCollectionGaugeArm,
    pub constraint_block: Array2<f64>,
    pub owner_terms: Vec<usize>,
    pub has_parametric_block: bool,
    pub local_identifiability_transform: Option<Array2<f64>>,
    pub joint_null_rotation: Option<JointNullRotation>,
    pub coefficient_transform: Array2<f64>,
    pub local_columns: usize,
}
Expand description

The COLLECTION’s gauge for one smooth term: the realized constraint block it was made orthogonal to, and which construction did it.

§Why this is freezable, and why a term-local rebuild needs it

C = [intercept | owned linear axes | owner smooths' realized blocks] is a function of the data and of OTHER terms — never of this term’s own basis parameters. So C is invariant along an outer search over this term’s ψ (a length scale, a curvature, a measure-jet dial), while the two objects derived FROM it are not: T and R are both functions of the realized design, so both move with ψ.

That asymmetry is the whole content of gam#2747’s second half. The spatial outer search rebuilds one term LOCALLY per trial and splices the result into the collection design; a term-local build cannot see C, so before this existed the splice replaced the design and its chart while leaving the collection’s R behind, and the fit shipped X(ψ̂)·Z − C·R(ψ₀) — a block orthogonal to nothing, with ‖XᵀC‖/(‖X‖‖C‖) measured at 4.15e-1 against the 1e-8 bar the same step asserts whenever it applies a transform.

Carrying the ψ-INDEPENDENT half forward and re-deriving the ψ-dependent half is therefore not an optimization — it is the only formulation under which the criterion an outer search minimizes and the model the fit ships are the same object.

Fields§

§arm: SmoothCollectionGaugeArm

Which construction the collection chose.

§constraint_block: Array2<f64>

C, n × q, exactly as build_constraint_block stacked it.

§owner_terms: Vec<usize>

Indices into the collection’s smooth terms of the owner smooths whose realized designs joined C, in stack order. Recorded for the same reason ParametricResidualizationChart::owner_terms is.

§has_parametric_block: bool

Whether the parametric block led C.

§local_identifiability_transform: Option<Array2<f64>>

The TERM-LOCAL identifiability chart the gauged block was derived ON — z_local, before this gauge composed its own T on top of it (gam#2760).

The term’s BasisMetadata records the COMPOSITION z_local · T0, which is what a predict-time replay wants. A caller that moves ψ must rebuild in z_local, then apply the separately stored fixed Self::coefficient_transform and fixed row-space projection. Starting from the composition would apply T0 twice.

Measured before this existed, on a one-Duchon-term collection with C = [1] and the Delete arm: the replay spec carried FrozenTransform(12, 11), the doubly-charted rebuild had orthogonality residual 1.5e-12 at the fit’s own and 9.0e-1 one octave away. The term reached the splice one column short and every κ fixture on a Duchon term refused in 0.2 s.

None means the term-local build applied no chart of its own. The radial families under OrthogonalToParametric defer entirely to this gauge and report an identity placeholder instead (freeze_raw_spatial_metadata), so for them this is Some(I); either way it carries no rotation.

Like C and the arm, this is ψ-INDEPENDENT: it is a center-space constraint (1ᵀα = 0, a linear-orthogonality frame) or a frozen replay chart, never a function of the realized design.

§joint_null_rotation: Option<JointNullRotation>

The stage-2 joint-null absorption rotation Q the collection applied to this term’s TERM-LOCAL build BEFORE it derived Self::coefficient_transform (gam#2760).

The aggregation loop rotates the local design and penalties by Q, and T0 is then derived on X_local · Q, so the complete fixed map from the local build’s own coordinates to the collection’s is Q · T0. Once the gauge has composed Q · T0 into the term’s metadata the term reports None for its own rotation, and Q cannot be recovered from the composition, so it travels here: a moving-ψ replay rebuilds in the local chart above, applies Q, and only then the fixed T0 — the order the collection used.

Measured before this existed, on the kappa_loop_n_scaling Duchon spec at the fit’s OWN length scale: the replay put the unrotated block through the chart derived on the rotated one, every design column and every penalty block came out wrong (‖ΔS‖_F/‖S‖_F 0.69–1.41, nullities [1,10,0,0,1] → [4,10,2,1,3]), and the criterion sat 679 above the collection’s at n = 1000 — the “route agreement” gap the joint κ search was then minimizing against.

ψ-INDEPENDENT like the rest of this gauge: an orthogonal chart chosen once at the reference realization and never re-derived.

§coefficient_transform: Array2<f64>

The collection coefficient chart derived at the fit’s reference realization, in TERM-LOCAL coefficient coordinates.

This is a coordinate section, not a statistical parameter. A spatial outer move therefore replays this fixed T0 and projects the moving value design on the LEFT through the fixed row-space complement of C: X_g(psi) = P_C X_local(psi) T0. Re-deriving RRQR/eigenvectors T(psi) at every trial makes the objective depend on an arbitrary moving coefficient chart; after per-penalty Frobenius normalization it even changes the meaning of fixed rho. Penalties and local inequality rows are consequently transported through this same fixed transform.

§local_columns: usize

The width of the TERM-LOCAL block this gauge was derived on, before the arm ran (gam#2760).

The collection’s stored width is coefficient_transform.ncols(). A moving-psi rebuild whose LOCAL width differs from this value is not the basis the fixed chart was derived on and is a defect; numerical rank may change at a trial, but it must never change the number or identity of coefficient coordinates.

Trait Implementations§

Source§

impl Clone for SmoothCollectionGauge

Source§

fn clone(&self) -> SmoothCollectionGauge

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 Debug for SmoothCollectionGauge

Source§

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

Formats the value using the given formatter. Read more

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> 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> DistributionExt for T
where T: ?Sized,

Source§

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

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<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 = !

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

fn try_from(value: U) -> Result<T, !>

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