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: DerivativeStorageModeImplementations§
Source§impl ResourcePolicy
impl ResourcePolicy
Sourcepub const fn default_library() -> Self
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.
Sourcepub const fn analytic_operator_required() -> Self
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.).
Sourcepub const fn for_problem(
n_rows: usize,
p_estimate: usize,
hints: ProblemHints,
) -> Self
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)
Sourcepub const fn permissive_small_data() -> Self
pub const fn permissive_small_data() -> Self
Permissive mode for small-data usage and tests.
pub const fn material_policy(&self) -> MaterializationPolicy
Trait Implementations§
Source§impl Clone for ResourcePolicy
impl Clone for ResourcePolicy
Source§fn clone(&self) -> ResourcePolicy
fn clone(&self) -> ResourcePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ResourcePolicy
impl RefUnwindSafe for ResourcePolicy
impl Send for ResourcePolicy
impl Sync for ResourcePolicy
impl Unpin for ResourcePolicy
impl UnsafeUnpin for ResourcePolicy
impl UnwindSafe for ResourcePolicy
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more