pub trait BlockExcessTarget {
// Required methods
fn block_dim(&self) -> usize;
fn rho_dim(&self) -> usize;
fn block_curvatures(&self) -> &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>;
fn excess(&self, t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>) -> f64;
fn excess_rho_gradient(
&self,
t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>;
fn displaced_neg_score(
&self,
t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>;
fn base_neg_score(&self) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>;
// Provided methods
fn excess_with_displaced_neg_score(
&self,
t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> (f64, Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>) { ... }
fn excess_with_displaced_neg_score_batch(
&self,
draws: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
) -> Vec<(f64, Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>)> { ... }
}Expand description
Caller-supplied evaluator for the non-Gaussian remainder ΔF(t) of the local
log-posterior, restricted to the curvature-heavy block subspace (issue #784).
Implemented by gam-solve’s Gam784BlockTarget; consumed by
LaplaceMarginalSampler::block_sampled_marginal_correction. Lives in this
neutral crate so both the implementor (gam-solve) and the sampler impl (the
gam-inference monolith) name the same trait without an SCC edge.
Required Methods§
Sourcefn block_dim(&self) -> usize
fn block_dim(&self) -> usize
Dimension m of the block subspace (number of untrustworthy directions
being sampled).
Sourcefn block_curvatures(&self) -> &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
fn block_curvatures(&self) -> &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
Block curvatures λ_r (the H-eigenvalues of the sampled directions),
length block_dim().
Sourcefn excess(&self, t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>) -> f64
fn excess(&self, t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>) -> f64
Non-Gaussian remainder ΔF(t) at whitened block displacement t
(length block_dim()).
Sourcefn excess_rho_gradient(
&self,
t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
fn excess_rho_gradient( &self, t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
ρ-gradient ∂ΔF/∂ρ_k at the same t, length rho_dim() — the explicit
penalty-score channel (a).
Sourcefn displaced_neg_score(
&self,
t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
fn displaced_neg_score( &self, t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>
Per-row displaced score ∂(D(η̂+s(t))/2φ)/∂η evaluated at η̂ + s(t)
(length = number of observation rows): the only per-draw ingredient of
the exact-gradient channels (b)–(d) the assembly side cannot reconstruct.
Provided Methods§
Sourcefn excess_with_displaced_neg_score(
&self,
t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>,
) -> (f64, Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>)
fn excess_with_displaced_neg_score( &self, t: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>, ) -> (f64, Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>)
Fused (excess(t), displaced_neg_score(t)). The returned score is None
exactly when the excess is non-finite (an infeasible draw the sampler
discards before reading the score). The default preserves the two-call
behavior; implementors override to share the displacement + jet.
Sourcefn excess_with_displaced_neg_score_batch(
&self,
draws: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
) -> Vec<(f64, Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>)>
fn excess_with_displaced_neg_score_batch( &self, draws: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, ) -> Vec<(f64, Option<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>>)>
Batched Self::excess_with_displaced_neg_score over many whitened draws
(one draw per COLUMN, shape block_dim() × n_draws). Batching may only
change HOW the shared linear algebra is computed (one BLAS-3 product over
all columns), never WHAT is computed. The default preserves the per-column
behavior exactly; the GLM implementor overrides it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".