Skip to main content

ResourcePolicy

Struct ResourcePolicy 

Source
pub struct ResourcePolicy {
    pub max_single_materialization_bytes: usize,
    pub max_operator_cache_bytes: usize,
    pub max_spatial_distance_cache_bytes: usize,
    pub max_owned_data_cache_bytes: usize,
    pub row_chunk_target_bytes: usize,
    pub derivative_storage_mode: DerivativeStorageMode,
}

Fields§

§max_single_materialization_bytes: usize§max_operator_cache_bytes: usize§max_spatial_distance_cache_bytes: usize§max_owned_data_cache_bytes: usize§row_chunk_target_bytes: usize§derivative_storage_mode: DerivativeStorageMode

Implementations§

Source§

impl ResourcePolicy

Source

pub const fn default_library() -> Self

Conservative default suitable for general-purpose use.

Uses MaterializeIfSmall: dense materialization is allowed only when the matrix fits under max_single_materialization_bytes. This lets small-data families that lack an implicit operator work out of the box, while pathologically large problems still error out and force the analytic-operator path. Set derivative_storage_mode = AnalyticOperatorRequired explicitly to reject all dense fallback.

The 1 GiB single-materialization budget matches the established large-scale densification ceiling used elsewhere in the codebase (e.g. CoefficientTransformOperator::MATERIALIZE_MAX_BYTES). Real large-scale GAMLSS spatial designs (320k rows × ~130 cols ≈ 0.32 GiB) must be materializable under this default because their families (e.g. BinomialLocationScale) eagerly densify in build_location_scale_block and have no operator-only fallback. A tighter cap silently classified those as “too big” even though the only available code path is the dense one.

Source

pub const fn analytic_operator_required() -> Self

Strict mode that rejects every dense fallback. Use when you intend to run only on operator-backed bases (large-scale Duchon/TPS, exact GAMLSS marginal slope, CTN, etc.).

Source

pub const fn for_problem( n_rows: usize, p_estimate: usize, hints: ProblemHints, ) -> Self

Auto-derive the resource policy from the shape of the problem rather than from an explicit CLI flag. The library refuses to silently densify operator-backed designs once the problem is large enough that a hidden dense fallback would blow real-world memory budgets, but keeps the permissive default for ordinary small-data fits so that non-operator bases still work out of the box.

Strict mode (AnalyticOperatorRequired) is selected when ANY of:

  • n_rows >= STRICT_POLICY_NROWS_THRESHOLD (large scale by row count)
  • p_estimate >= STRICT_POLICY_P_THRESHOLD (large scale by coefficient count)
  • hints.marginal_slope_large_scale_active (the GAMLSS marginal-slope large-scale path is in play; the corresponding operators MUST stay matrix-free regardless of n)
Source

pub const fn permissive_small_data() -> Self

Permissive mode for small-data usage and tests.

Source

pub const fn material_policy(&self) -> MaterializationPolicy

Trait Implementations§

Source§

impl Clone for ResourcePolicy

Source§

fn clone(&self) -> ResourcePolicy

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 ResourcePolicy

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> 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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.