pub enum PenaltySpec {
Block {
local: ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
col_range: Range<usize>,
prior_mean: CoefficientPriorMean,
structure_hint: Option<PenaltyStructureHint>,
op: Option<Arc<dyn PenaltyOp>>,
},
Dense(ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>),
DenseWithMean {
matrix: ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
prior_mean: CoefficientPriorMean,
},
}Expand description
A penalty specification for the public estimate API.
Block stores only the active sub-block and its column range, avoiding
the O(p^2) cost of embedding into a full penalty matrix.
Dense stores a full p x p penalty matrix for callers that already
have one.
Variants§
Block
Block-local penalty: local is block_dim x block_dim,
applied to columns col_range of the coefficient vector.
Fields
prior_mean: CoefficientPriorMeanstructure_hint: Option<PenaltyStructureHint>Optional structural hint for fast-path spectral decomposition.
Dense(ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>)
Full dense penalty matrix (p x p).
DenseWithMean
Full dense penalty matrix with a programmatic prior mean in the same global coefficient basis.
Implementations§
Source§impl PenaltySpec
impl PenaltySpec
Sourcepub fn col_range(&self, p: usize) -> Range<usize>
pub fn col_range(&self, p: usize) -> Range<usize>
The column range this penalty covers.
For Dense, this is 0..p where p = m.ncols().
Sourcepub fn op(&self) -> Option<&Arc<dyn PenaltyOp>>
pub fn op(&self) -> Option<&Arc<dyn PenaltyOp>>
Op-form handle when present (only for Block; Dense always returns None).
Sourcepub fn from_blockwise(bp: BlockwisePenalty) -> PenaltySpec
pub fn from_blockwise(bp: BlockwisePenalty) -> PenaltySpec
Convert from a BlockwisePenalty, preserving the structure hint and op.
pub fn from_blockwise_ref(bp: &BlockwisePenalty) -> PenaltySpec
Trait Implementations§
Source§impl Clone for PenaltySpec
impl Clone for PenaltySpec
Source§fn clone(&self) -> PenaltySpec
fn clone(&self) -> PenaltySpec
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 !RefUnwindSafe for PenaltySpec
impl !UnwindSafe for PenaltySpec
impl Freeze for PenaltySpec
impl Send for PenaltySpec
impl Sync for PenaltySpec
impl Unpin for PenaltySpec
impl UnsafeUnpin for PenaltySpec
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.