Skip to main content

RowJacobianOperator

Trait RowJacobianOperator 

Source
pub trait RowJacobianOperator: Send + Sync {
    // Required methods
    fn k(&self) -> usize;
    fn ncols(&self) -> usize;
    fn nrows(&self) -> usize;
    fn apply_row(&self, row: usize, delta_beta: &[f64], out: &mut [f64]);
    fn evaluate_full(&self) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>;

    // Provided methods
    fn scaled_design_by_sqrt_h(
        &self,
        h_full: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>,
    ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>> { ... }
    fn channel_flattened_column(&self, col: usize, out: &mut [f64]) { ... }
    fn channel_flattened_rows(
        &self,
        rows: Range<usize>,
        out: &mut ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>,
    ) { ... }
}
Expand description

Maps a coefficient perturbation δβ ∈ R^p for one parameter block into its contribution to the per-row primary state u_i ∈ R^K.

For affine blocks (everything in this compiler), J_i = ∂u_i/∂β_block is independent of β and equals the transposed row of the block’s effective design matrix lifted into R^K.

Required Methods§

Source

fn k(&self) -> usize

Dimension of the row primary state (survival: 4, Bernoulli: 1).

Source

fn ncols(&self) -> usize

Number of coefficients in this block (= width of J_i).

Source

fn nrows(&self) -> usize

Number of training rows.

Source

fn apply_row(&self, row: usize, delta_beta: &[f64], out: &mut [f64])

Apply the row Jacobian: writes J_i · δβ ∈ R^K for row into out.

Source

fn evaluate_full(&self) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>

Materialise the full operator as an (n_rows × ncols × K) tensor.

Provided Methods§

Source

fn scaled_design_by_sqrt_h( &self, h_full: &ArrayBase<OwnedRepr<f64>, Dim<[usize; 3]>>, ) -> ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>

Build the sqrt(H)-scaled design W = stack_i sqrt(H_i) · J_i, flattened channel-major to (n_rows·K × ncols).

This is the representation the identifiability compiler (compile_with_dual_metric) actually consumes — it residualises and eigendecomposes Grams of W, and never indexes the per-row (n, p, K) tensor element-wise. Requesting the scaled design directly lets an operator with a structured / streaming form supply it without materialising and cloning the whole O(n·p·K) tensor; the default implementation routes through evaluate_full so existing operators remain correct unchanged. (#738: a capability is not a representation — the compiler asks for the scaled design it needs, not the dense tensor.)

Source

fn channel_flattened_column(&self, col: usize, out: &mut [f64])

Write the channel-flattened column col — the (n_rows · K) vector whose entry i·K + ch is J[i, col, ch] — into out.

This is the representation the identifiability audit actually consumes (per-column leverage statistics and pairwise overlaps), as opposed to the dense (n, p, K) tensor. Requesting a column directly lets an operator that has a structured / streaming form supply it without materialising and cloning the whole O(n·p·K) tensor on every audit pass; the default implementation routes through evaluate_full so existing operators remain correct unchanged. (#738: a capability is not a representation — the audit asks for the column view it needs, not the tensor.)

Source

fn channel_flattened_rows( &self, rows: Range<usize>, out: &mut ArrayBase<OwnedRepr<f64>, Dim<[usize; 2]>>, )

Write channel-flattened rows for rows into out.

out has shape (rows.len() * K, ncols), with row local_row * K + channel holding J[row, :, channel]. The default implementation materialises the full tensor for legacy operators; large construction-time adapters override this to stream row chunks.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§