pub struct SparseDirectionalHyperOperator { /* private fields */ }Expand description
Operator-backed fixed-β Hessian drift for sparse-exact τ coordinates.
This stays in the original sparse/native coefficient basis and computes the exact first-order τ Hessian drift B_τ = X_τᵀ W X + Xᵀ W X_τ + Xᵀ diag(c ⊙ X_τ β̂) X + S_τ − (H_φ)_{τ}|_β without materializing the full dense matrix up front.
Trait Implementations§
Source§impl HyperOperator for SparseDirectionalHyperOperator
impl HyperOperator for SparseDirectionalHyperOperator
Source§fn dim(&self) -> usize
fn dim(&self) -> usize
Operator dimension
p such that B · v consumes a p-vector and
produces a p-vector.Source§fn mul_vec(&self, v: &Array1<f64>) -> Array1<f64>
fn mul_vec(&self, v: &Array1<f64>) -> Array1<f64>
Compute B · v (matrix-vector product). v and result are p-vectors.
Source§fn is_implicit(&self) -> bool
fn is_implicit(&self) -> bool
Whether this operator uses implicit (non-materialized) storage.
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Expose the concrete type for solver-local downcast helpers when the
implementor has a
'static concrete type. Borrowing adapters may keep
the default, which simply cannot downcast.Source§fn mul_vec_view(
&self,
v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
fn mul_vec_view( &self, v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
Compute B · v from a vector view.
Source§fn mul_vec_into(
&self,
v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>,
out: ArrayBase<ViewRepr<&mut f64>, Dim<[usize; 1]>>,
)
fn mul_vec_into( &self, v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>, out: ArrayBase<ViewRepr<&mut f64>, Dim<[usize; 1]>>, )
Compute B · v into caller-owned storage.
Source§fn mul_mat(
&self,
factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
fn mul_mat( &self, factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
Compute B · F where F is (p × k). Default dispatches per-column in
parallel unless already inside a rayon worker.
Source§fn trace_projected_factor(
&self,
factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
) -> f64
fn trace_projected_factor( &self, factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ) -> f64
Compute
trace(F^T B F) for a (p x k) factor matrix F.Source§fn projection_design_id(&self) -> Option<usize>
fn projection_design_id(&self) -> Option<usize>
Optional stable identity for this operator’s action
B. When Some,
the default cached trace / projected-matrix paths memoize the B · F
product in the shared ProjectedFactorCache under a
(design_id, factor) key, so repeated projections of the same factor
against the same operator within one outer iteration build B · F
once. None (the default) disables that reuse: an operator with no
design factor stable across calls cannot key the cache without risking
a stale B · F, so it recomputes every time.fn trace_projected_factor_cached( &self, factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, factor_cache: &ProjectedFactorCache, ) -> f64
Source§fn projected_matrix(
&self,
factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
fn projected_matrix( &self, factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
Compute the exact projected matrix
F^T B F.Source§fn projected_matrix_cached(
&self,
factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
factor_cache: &ProjectedFactorCache,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
fn projected_matrix_cached( &self, factor: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, factor_cache: &ProjectedFactorCache, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>
Compute the exact projected matrix
F^T B F, reusing caller-owned
projection caches when the operator has a shared row/design factor.Source§fn mul_basis_columns_into(
&self,
start: usize,
out: ArrayBase<ViewRepr<&mut f64>, Dim<[usize; 2]>>,
)
fn mul_basis_columns_into( &self, start: usize, out: ArrayBase<ViewRepr<&mut f64>, Dim<[usize; 2]>>, )
Fill columns
[start, start + out.ncols()) of B into out.Source§fn scaled_add_mul_vec(
&self,
v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>,
scale: f64,
out: ArrayBase<ViewRepr<&mut f64>, Dim<[usize; 1]>>,
)
fn scaled_add_mul_vec( &self, v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>, scale: f64, out: ArrayBase<ViewRepr<&mut f64>, Dim<[usize; 1]>>, )
Accumulate
scale * B · v into caller-owned storage.Source§fn bilinear(
&self,
v: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
u: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> f64
fn bilinear( &self, v: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, u: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, ) -> f64
Compute v^T · B · u (bilinear form).
Source§fn bilinear_view(
&self,
v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>,
u: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>,
) -> f64
fn bilinear_view( &self, v: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>, u: ArrayBase<ViewRepr<&f64>, Dim<[usize; 1]>>, ) -> f64
Compute v^T · B · u without requiring owned vector inputs.
Source§fn has_fast_bilinear_view(&self) -> bool
fn has_fast_bilinear_view(&self) -> bool
Whether
bilinear_view is implemented as a direct scalar contraction.Auto Trait Implementations§
impl !RefUnwindSafe for SparseDirectionalHyperOperator
impl !UnwindSafe for SparseDirectionalHyperOperator
impl Freeze for SparseDirectionalHyperOperator
impl Send for SparseDirectionalHyperOperator
impl Sync for SparseDirectionalHyperOperator
impl Unpin for SparseDirectionalHyperOperator
impl UnsafeUnpin for SparseDirectionalHyperOperator
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
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> 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.