Skip to main content

RowProgram

Trait RowProgram 

Source
pub trait RowProgram<const K: usize>: Send + Sync {
    // Required methods
    fn n_rows(&self) -> usize;
    fn primaries(&self, row: usize) -> Result<[f64; K], String>;
    fn eval<S: JetScalar<K>>(&self, row: usize, p: &[S; K]) -> Result<S, String>;
}
Expand description

The single source of truth #932 asks for: a family’s row negative log-likelihood written ONCE over the generic crate::jet_scalar::JetScalar interface, from which every RowKernel (gam-models) derivative channel is mechanically derived. A family implements ONLY this (plus its linear Jacobian wiring, which is family data, not calculus) — it cannot author an independent derivative tower, because there is no other channel to author.

Because a body uses only add/sub/mul/scale/exp/ln/… — all provided by crate::jet_scalar::JetScalar — the SAME body re-instantiates at crate::jet_scalar::Order2 (value/grad/Hessian), crate::jet_scalar::OneSeed (contracted third), crate::jet_scalar::TwoSeed (contracted fourth), and the full Tower4 (every channel), with the contraction folded into the differentiation so no dense t3/t4 is ever materialised.

Required Methods§

Source

fn n_rows(&self) -> usize

Number of observations the program covers.

Source

fn primaries(&self, row: usize) -> Result<[f64; K], String>

Current primary-scalar values for row (where to seed the scalar).

Source

fn eval<S: JetScalar<K>>(&self, row: usize, p: &[S; K]) -> Result<S, String>

The row NLL evaluated on a generic jet scalar. p[a] arrives pre-seeded (base value + per-scalar nilpotent directions) by the caller; the body uses ONLY crate::jet_scalar::JetScalar ops and per-row data (response, censoring, offsets) entering as constants.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§