pub struct KroneckerPenaltySystem {
pub marginal_penalties: Vec<Array2<f64>>,
pub marginal_eigensystems: Vec<(Array1<f64>, Array2<f64>)>,
pub marginal_dims: Vec<usize>,
pub has_double_penalty: bool,
}Expand description
Factored representation of tensor-product penalties with precomputed marginal eigensystems for O(∏q_j) logdet and penalty operations.
Fields§
§marginal_penalties: Vec<Array2<f64>>Marginal penalty matrices: marginal_penalties[k] is (q_k, q_k).
marginal_eigensystems: Vec<(Array1<f64>, Array2<f64>)>Precomputed eigensystems: (eigenvalues, eigenvectors) per marginal.
marginal_dims: Vec<usize>Marginal basis dimensions.
has_double_penalty: boolWhether a global ridge (double) penalty is present.
Implementations§
Source§impl KroneckerPenaltySystem
impl KroneckerPenaltySystem
pub fn new( marginal_penalties: Vec<Array2<f64>>, marginal_dims: Vec<usize>, has_double_penalty: bool, ) -> Result<Self, BasisError>
pub fn p_total(&self) -> usize
pub fn ndim(&self) -> usize
pub fn num_penalties(&self) -> usize
Sourcepub fn logdet_and_derivatives(
&self,
lambdas: &[f64],
ridge: f64,
) -> (f64, Array1<f64>, Array2<f64>)
pub fn logdet_and_derivatives( &self, lambdas: &[f64], ridge: f64, ) -> (f64, Array1<f64>, Array2<f64>)
Compute log|S|₊ and its first/second derivatives w.r.t. ρ_k = log(λ_k).
Iterates over the ∏q_j multi-index grid. Cost: O(d · ∏q_j), no O(p²) storage.
pub fn logdet_rank_and_derivatives( &self, lambdas: &[f64], ridge: f64, ) -> (f64, usize, Array1<f64>, Array2<f64>)
Trait Implementations§
Source§impl Clone for KroneckerPenaltySystem
impl Clone for KroneckerPenaltySystem
Source§fn clone(&self) -> KroneckerPenaltySystem
fn clone(&self) -> KroneckerPenaltySystem
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for KroneckerPenaltySystem
impl RefUnwindSafe for KroneckerPenaltySystem
impl Send for KroneckerPenaltySystem
impl Sync for KroneckerPenaltySystem
impl Unpin for KroneckerPenaltySystem
impl UnsafeUnpin for KroneckerPenaltySystem
impl UnwindSafe for KroneckerPenaltySystem
Blanket Implementations§
impl<T> Allocation for T
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
Mutably borrows from an owned value. Read more
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>
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 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>
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 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.