pub struct DenseSpectralOperator { /* private fields */ }Expand description
Dense spectral Hessian operator using eigendecomposition.
Computes logdet, trace, and solve from a single eigendecomposition,
guaranteeing spectral consistency. Indefinite or near-singular eigenvalues
are handled via smooth spectral regularization r_ε(σ) rather than hard
clamping, ensuring that logdet and inverse use the same smooth mapping.
Implementations§
Source§impl DenseSpectralOperator
impl DenseSpectralOperator
Sourcepub fn from_symmetric(h: &Array2<f64>) -> Result<Self, String>
pub fn from_symmetric(h: &Array2<f64>) -> Result<Self, String>
Create from a symmetric matrix (may be indefinite or singular).
The eigendecomposition is computed once. Eigenvalues are smoothly
regularized via r_ε(σ). All subsequent operations (logdet, trace,
solve) use the regularized spectrum, ensuring mathematical consistency.
Sourcepub fn from_symmetric_with_mode(
h: &Array2<f64>,
mode: PseudoLogdetMode,
) -> Result<Self, String>
pub fn from_symmetric_with_mode( h: &Array2<f64>, mode: PseudoLogdetMode, ) -> Result<Self, String>
Variant of from_symmetric that selects the
log-determinant convention.
See PseudoLogdetMode for the derivation and the exact set of
kernels that differ between the two modes. At a high level:
Smooth keeps every eigenpair in play with a soft floor, whereas
HardPseudo masks out σ_j ≤ ε consistently across logdet,
gradient traces, cross-traces, and the H⁻¹ kernels.
Sourcepub fn logdet_gradient_factor(&self) -> &Array2<f64>
pub fn logdet_gradient_factor(&self) -> &Array2<f64>
Factor F satisfying trace(G_epsilon(H) A) = trace(F^T A F).
Structured row-local operators use this to contract the logdet-gradient
trace directly in row space without forming A F in coefficient space.
Trait Implementations§
Source§impl HessianOperator for DenseSpectralOperator
impl HessianOperator for DenseSpectralOperator
Source§fn as_exact_dense_spectral(&self) -> Option<&DenseSpectralOperator>
fn as_exact_dense_spectral(&self) -> Option<&DenseSpectralOperator>
Source§fn assemble_h_dense_for_tangent_projection(&self) -> Result<Array2<f64>, String>
fn assemble_h_dense_for_tangent_projection(&self) -> Result<Array2<f64>, String>
Source§fn trace_hinv_product(&self, a: &Array2<f64>) -> f64
fn trace_hinv_product(&self, a: &Array2<f64>) -> f64
logdet.Source§fn solve(&self, rhs: &Array1<f64>) -> Array1<f64>
fn solve(&self, rhs: &Array1<f64>) -> Array1<f64>
Source§fn trace_hinv_product_cross(&self, a: &Array2<f64>, b: &Array2<f64>) -> f64
fn trace_hinv_product_cross(&self, a: &Array2<f64>, b: &Array2<f64>) -> f64
Source§fn trace_hinv_operator(&self, op: &dyn HyperOperator) -> f64
fn trace_hinv_operator(&self, op: &dyn HyperOperator) -> f64
Source§fn trace_hinv_matrix_operator_cross(
&self,
matrix: &Array2<f64>,
op: &dyn HyperOperator,
) -> f64
fn trace_hinv_matrix_operator_cross( &self, matrix: &Array2<f64>, op: &dyn HyperOperator, ) -> f64
Source§fn trace_hinv_operator_cross(
&self,
left: &dyn HyperOperator,
right: &dyn HyperOperator,
) -> f64
fn trace_hinv_operator_cross( &self, left: &dyn HyperOperator, right: &dyn HyperOperator, ) -> f64
Source§fn trace_logdet_gradient(&self, a: &Array2<f64>) -> f64
fn trace_logdet_gradient(&self, a: &Array2<f64>) -> f64
Source§fn xt_logdet_kernel_x_diagonal(&self, x: &DesignMatrix) -> Array1<f64>
fn xt_logdet_kernel_x_diagonal(&self, x: &DesignMatrix) -> Array1<f64>
trace_logdet_gradient.
trace_logdet_gradient(Xᵀ diag(w) X) = Σᵢ wᵢ · h^G[i]. Read moreSource§fn trace_logdet_block_local(
&self,
block: &Array2<f64>,
scale: f64,
start: usize,
end: usize,
) -> f64
fn trace_logdet_block_local( &self, block: &Array2<f64>, scale: f64, start: usize, end: usize, ) -> f64
Source§fn trace_logdet_operator(&self, op: &dyn HyperOperator) -> f64
fn trace_logdet_operator(&self, op: &dyn HyperOperator) -> f64
Source§fn trace_logdet_hessian_cross(
&self,
h_i: &Array2<f64>,
h_j: &Array2<f64>,
) -> f64
fn trace_logdet_hessian_cross( &self, h_i: &Array2<f64>, h_j: &Array2<f64>, ) -> f64
∂²_{ij} log|R_ε(H)| = tr(G_ε Ḧ_{ij}) + spectral_cross(Ḣ_i, Ḣ_j). Read moreSource§fn trace_logdet_hessian_cross_matrix_operator(
&self,
h_i: &Array2<f64>,
h_j: &dyn HyperOperator,
) -> f64
fn trace_logdet_hessian_cross_matrix_operator( &self, h_i: &Array2<f64>, h_j: &dyn HyperOperator, ) -> f64
trace_logdet_hessian_cross]. Read moreSource§fn trace_logdet_hessian_cross_operator(
&self,
h_i: &dyn HyperOperator,
h_j: &dyn HyperOperator,
) -> f64
fn trace_logdet_hessian_cross_operator( &self, h_i: &dyn HyperOperator, h_j: &dyn HyperOperator, ) -> f64
trace_logdet_hessian_cross]. Read moreSource§fn active_rank(&self) -> usize
fn active_rank(&self) -> usize
Source§fn is_dense(&self) -> bool
fn is_dense(&self) -> bool
Source§fn prefers_stochastic_trace_estimation(&self) -> bool
fn prefers_stochastic_trace_estimation(&self) -> bool
Source§fn logdet_traces_match_hinv_kernel(&self) -> bool
fn logdet_traces_match_hinv_kernel(&self) -> bool
H⁻¹ are valid for
logdet-gradient / logdet-Hessian trace terms on this backend. Read moreSource§fn as_dense_spectral(&self) -> Option<&DenseSpectralOperator>
fn as_dense_spectral(&self) -> Option<&DenseSpectralOperator>
Source§fn stochastic_trace_solve(&self, rhs: &Array1<f64>, rel_tol: f64) -> Array1<f64>
fn stochastic_trace_solve(&self, rhs: &Array1<f64>, rel_tol: f64) -> Array1<f64>
Source§fn stochastic_trace_solve_for_probe(
&self,
rhs: &Array1<f64>,
rel_tol: f64,
probe_id: u64,
state: Option<&Arc<Mutex<StochasticTraceState>>>,
) -> Array1<f64>
fn stochastic_trace_solve_for_probe( &self, rhs: &Array1<f64>, rel_tol: f64, probe_id: u64, state: Option<&Arc<Mutex<StochasticTraceState>>>, ) -> Array1<f64>
Source§fn stochastic_trace_solve_multi(
&self,
rhs: &Array2<f64>,
rel_tol: f64,
) -> Array2<f64>
fn stochastic_trace_solve_multi( &self, rhs: &Array2<f64>, rel_tol: f64, ) -> Array2<f64>
Source§fn has_matrix_free_trace_cg_operator(&self) -> bool
fn has_matrix_free_trace_cg_operator(&self) -> bool
Auto Trait Implementations§
impl !Freeze for DenseSpectralOperator
impl RefUnwindSafe for DenseSpectralOperator
impl Send for DenseSpectralOperator
impl Sync for DenseSpectralOperator
impl Unpin for DenseSpectralOperator
impl UnsafeUnpin for DenseSpectralOperator
impl UnwindSafe for DenseSpectralOperator
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.