Skip to main content

ResidentBaseArrowFrameHandle

Struct ResidentBaseArrowFrameHandle 

Source
pub struct ResidentBaseArrowFrameHandle { /* private fields */ }
Expand description

#1017: a BASE-block-resident Arrow-Schur frame for the LM ridge ladder.

Unlike ResidentArrowFrameHandle — which BAKES one ridge into its factors and then serves cheap re-solves for a NEW GRADIENT at that SAME ridge — this frame holds the ridge-INDEPENDENT base blocks (D = H_tt, B = H_tβ, border H_ββ, gradient) resident and RE-FACTORS on-device at each requested (ridge_t, ridge_beta). That is the regime solve_with_lm_escalation_inner actually runs: its trials re-solve the SAME system (same gradient) at ESCALATING ridges, so the factor changes every trial but the base blocks do not. The base blocks upload ONCE; each trial pays only a device-to-device copy of the base blocks into scratch, an on-device diagonal ridge add, and the factor/solve — in place of the full O(n·d·k) host→device re-upload that solve_arrow_newton_step performs every trial. The per-trial numerics are bit-identical to that re-upload path (same POTRF/TRSM/Schur/back-sub order).

Implementations§

Source§

impl ResidentBaseArrowFrameHandle

Source

pub fn new( sys: &ArrowSchurSystem, newton_schur_tikhonov_rel_floor: Option<f64>, ) -> Result<Self, ArrowSchurGpuFailure>

Upload the ridge-independent base blocks once. No factorization runs here; each Self::refactor_and_solve performs the ridge-dependent factor+solve. The dense device path requires materialised blocks, so a matrix-free H_ββ / H_tβ operator is rejected (same admission as solve_arrow_newton_step).

Source

pub fn refactor_and_solve( &self, ridge_t: f64, ridge_beta: f64, ) -> Result<ArrowSchurGpuSolution, ArrowSchurGpuFailure>

Factor the resident base blocks at (ridge_t, ridge_beta) and solve (H + ridge)·δ = −gradient. Only the two ridge scalars and the tiny re-diagonalised D cross to the device; only δ crosses back. A non-PD per-row block surfaces as ArrowSchurGpuFailure::RidgeBumpRequired so the LM escalation bumps and retries at the larger ridge exactly as the re-upload path does.

Source

pub fn refactor_and_solve_with_gradient( &self, ridge_t: f64, ridge_beta: f64, g_t: &[f64], g_beta: &[f64], ) -> Result<ArrowSchurGpuSolution, ArrowSchurGpuFailure>

As Self::refactor_and_solve, but solves for a FRESH gradient instead of the one captured at construction (#2539).

Self::refactor_and_solve was built for the LM ridge ladder, whose trials re-solve the SAME system at escalating ridges, so it reads the resident g_t/g_β. An inner Newton moves the gradient every iterate while the Hessian blocks stay fixed, so it needs this variant: g_t (n·d doubles) and g_β (k) cross to the device in place of the device-to-device copy of the resident gradient, and the D/B/H_ββ blocks stay resident exactly as they do there. Everything after the gradient sourcing — POTRF/TRSM/Schur/back-substitution and their order — is the same code, so a solve here is bit-identical to a ResidentArrowFrameHandle rebuild at the same ridge and gradient.

Source

pub fn factor_at( &self, ridge_t: f64, ridge_beta: f64, ) -> Result<ResidentBaseRidgeFactorsHandle, ArrowSchurGpuFailure>

Run only the ridge-dependent FACTOR work and hand the factors back, so a caller whose ridge does not move on the next iterate can re-solve without re-factoring (#2539).

Self::refactor_and_solve_with_gradient is exactly this followed by Self::solve_with_factors. An inner Newton needs them separately: its ridge changes only on an LM accept/reject, while its gradient changes every iterate, so factoring per iterate would pay a POTRF/TRSM/Schur chain for a factor that did not move — the accepted-step cost the ridge-keyed frame used to avoid.

Source

pub fn solve_with_factors( &self, factors: &ResidentBaseRidgeFactorsHandle, g_t: &[f64], g_beta: &[f64], ) -> Result<ArrowSchurGpuSolution, ArrowSchurGpuFailure>

Solve (H + ridge)·δ = −gradient against factors from Self::factor_at. No POTRF, no B whitening: only the gradient (n·d + k doubles) crosses to the device and only δ crosses back.

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> 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, 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