pub trait BlockEffectiveJacobian: Send + Sync {
// Required method
fn effective_jacobian_rows(
&self,
state: &FamilyLinearizationState<'_>,
rows: Range<usize>,
) -> Result<Array2<f64>, String>;
// Provided methods
fn effective_jacobian_at(
&self,
state: &FamilyLinearizationState<'_>,
) -> Result<Array2<f64>, String> { ... }
fn n_outputs(&self) -> usize { ... }
fn eta_row_scaling_for_skewness(&self) -> Option<Arc<[f64]>> { ... }
}Expand description
β-dependent Jacobian callback for a parameter block.
Principled long-term contract for expressing how a block contributes to the stacked linear predictor at a given β:
J(β) ∈ ℝ^{n_rows · n_outputs × p_block}- Single-output linear block: returns
design.clone(). - Row-scaled block (
RowScaledJacobian): returnsdiag(eta_scaling) · design(still linear in β). - Multi-output block (e.g. survival marginal-slope with η0, η1, ad1):
stacks
∂eta_r/∂β_kforr ∈ 0..n_outputs, row-major ordering.
The default impl on ParameterBlockSpec::effective_jacobian_at is:
jacobian_callback = None→design.clone().jacobian_callback = Some(cb)→ delegates tocb.effective_jacobian_at.
Required Methods§
Sourcefn effective_jacobian_rows(
&self,
state: &FamilyLinearizationState<'_>,
rows: Range<usize>,
) -> Result<Array2<f64>, String>
fn effective_jacobian_rows( &self, state: &FamilyLinearizationState<'_>, rows: Range<usize>, ) -> Result<Array2<f64>, String>
Stacked multi-output Jacobian for a contiguous observation row range.
Shape: (rows.len() * n_outputs, p_block), with the same channel-major
layout as Self::effective_jacobian_at: row
channel * rows.len() + local_row is rows.start + local_row in that
output channel. Implementations should keep this as the single source of
row math so large construction-time audits can stream chunks instead of
materialising all n * p * K entries at once.
Provided Methods§
Sourcefn effective_jacobian_at(
&self,
state: &FamilyLinearizationState<'_>,
) -> Result<Array2<f64>, String>
fn effective_jacobian_at( &self, state: &FamilyLinearizationState<'_>, ) -> Result<Array2<f64>, String>
Stacked multi-output Jacobian at the current β.
Shape: (n_rows * n_outputs, p_block), channel-major: rows
r * n_rows .. (r + 1) * n_rows carry output channel r’s row
Jacobian, so stacked[r * n_rows + i, j] is observation i’s row at
output r and coefficient column j. Every consumer that destacks
this matrix (audit, canonicaliser, fit) relies on this layout — see
BlockJacobianAsRowOp::from_callback for the destacking transpose.
For n_outputs = 1 this is identical to the (n_rows, p_block) effective
design used by the flat identifiability audit.
Sourcefn eta_row_scaling_for_skewness(&self) -> Option<Arc<[f64]>>
fn eta_row_scaling_for_skewness(&self) -> Option<Arc<[f64]>>
Returns the per-row scaling vector when this callback is a simple
diagonal-scaling block (RowScaledJacobian). Used by the
identifiability audit’s skewness-aware bias correction (T25).
Returns None for all blocks except RowScaledJacobian.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".