pub trait BlockExcessTarget {
// Required methods
fn block_dim(&self) -> usize;
fn rho_dim(&self) -> usize;
fn block_curvatures(&self) -> &Array1<f64>;
fn excess(&self, t: &Array1<f64>) -> f64;
fn excess_rho_gradient(&self, t: &Array1<f64>) -> Array1<f64>;
fn displaced_neg_score(&self, t: &Array1<f64>) -> Array1<f64>;
fn base_neg_score(&self) -> Array1<f64>;
// Provided methods
fn excess_with_displaced_neg_score(
&self,
t: &Array1<f64>,
) -> (f64, Option<Array1<f64>>) { ... }
fn excess_with_displaced_neg_score_batch(
&self,
draws: &Array2<f64>,
) -> Vec<(f64, Option<Array1<f64>>)> { ... }
}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) -> &Array1<f64>
fn block_curvatures(&self) -> &Array1<f64>
Block curvatures λ_r (the H-eigenvalues of the sampled directions),
length block_dim().
Sourcefn excess(&self, t: &Array1<f64>) -> f64
fn excess(&self, t: &Array1<f64>) -> f64
Non-Gaussian remainder ΔF(t) at whitened block displacement t
(length block_dim()).
Sourcefn excess_rho_gradient(&self, t: &Array1<f64>) -> Array1<f64>
fn excess_rho_gradient(&self, t: &Array1<f64>) -> Array1<f64>
ρ-gradient ∂ΔF/∂ρ_k at the same t, length rho_dim() — the explicit
penalty-score channel (a).
Sourcefn displaced_neg_score(&self, t: &Array1<f64>) -> Array1<f64>
fn displaced_neg_score(&self, t: &Array1<f64>) -> Array1<f64>
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.
Sourcefn base_neg_score(&self) -> Array1<f64>
fn base_neg_score(&self) -> Array1<f64>
The same per-row score channel at the undisplaced mode η̂.
Provided Methods§
Sourcefn excess_with_displaced_neg_score(
&self,
t: &Array1<f64>,
) -> (f64, Option<Array1<f64>>)
fn excess_with_displaced_neg_score( &self, t: &Array1<f64>, ) -> (f64, Option<Array1<f64>>)
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: &Array2<f64>,
) -> Vec<(f64, Option<Array1<f64>>)>
fn excess_with_displaced_neg_score_batch( &self, draws: &Array2<f64>, ) -> Vec<(f64, Option<Array1<f64>>)>
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".