pub struct Order1<const K: usize> {
pub v: f64,
pub g: [f64; K],
}Expand description
Truncated FIRST-order scalar: value v and gradient g_a only — NO Hessian.
This is Order2 with the K×K Hessian channel deleted. Its value and
gradient are computed by the SAME order-≤1 truncation of the Leibniz / Faà
di Bruno rules that Order2 uses for those two channels, with the float
operations applied in the identical order — so its (v, g) is BIT-IDENTICAL
to both Order2’s and a full crate::jet_tower::Tower4’s order-≤1
channels. Use it at a consumer that reads ONLY value + gradient (the SAE
β-border channel: the reconstruction is linear in β, so the Hessian-in-β
vanishes and the dense K×K Hessian product Tower2::mul would build is pure
discarded work). Order-≤1 value/gradient never read any input’s Hessian, so
dropping that channel changes neither result nor float-op order — it only
removes the K² arithmetic that produced an unread tensor.
Fields§
§v: f64Value ℓ.
g: [f64; K]Gradient ∂ℓ/∂p_a.
Implementations§
Trait Implementations§
impl<const K: usize> Copy for Order1<K>
Source§impl<const K: usize> JetField for Order1<K>
impl<const K: usize> JetField for Order1<K>
fn add(&self, o: &Self) -> Self
fn sub(&self, o: &Self) -> Self
fn mul(&self, o: &Self) -> Self
fn neg(&self) -> Self
Source§fn compose_unary(&self, d: [f64; 5]) -> Self
fn compose_unary(&self, d: [f64; 5]) -> Self
f ∘ self given the OUTER real function’s
derivative stack d = [f(u), f′(u), f″(u), f‴(u), f⁗(u)] evaluated at
u = self.value() — the identical [f64; 5] stack shape
crate::jet_tower::Tower4::compose_unary consumes.Source§fn constant_like(&self, v: f64) -> Self
fn constant_like(&self, v: f64) -> Self
v, every
derivative channel zero. Read moreSource§fn with_value(&self, v: f64) -> Self
fn with_value(&self, v: f64) -> Self
Source§impl<const K: usize> JetScalar<K> for Order1<K>
impl<const K: usize> JetScalar<K> for Order1<K>
Source§fn variable(x: f64, axis: usize) -> Self
fn variable(x: f64, axis: usize) -> Self
p_axis at value x: unit first derivative in slot
axis, all higher channels zero. (The nilpotent / cross channels of the
directional scalars are seeded zero — callers set ε/δ directions through
the scalar-specific OneSeed::seed_direction / TwoSeed::seed.)Source§fn symmetric_quadratic_form<C: SymmetricQuadraticCoefficients>(
inputs: &[Self],
coefficients: &C,
) -> Self
fn symmetric_quadratic_form<C: SymmetricQuadraticCoefficients>( inputs: &[Self], coefficients: &C, ) -> Self
inputs' A inputs from one universal semantic primitive.
Order-specific scalars may lower the mechanically derived channels
directly; the default is the exact scalar program over mul/add/scale.Source§fn linear_combination(inputs: &[Self], weights: &[f64]) -> Self
fn linear_combination(inputs: &[Self], weights: &[f64]) -> Self
sum_i weights[i] * inputs[i] in one semantic primitive.Source§fn add_constant(&self, constant: f64) -> Self
fn add_constant(&self, constant: f64) -> Self
Source§fn multiply_add(&self, right: &Self, addend: &Self) -> Self
fn multiply_add(&self, right: &Self, addend: &Self) -> Self
self * right + addend in one semantic primitive.Source§fn composed_sum(inputs: &[Self], derivative_stacks: &[[f64; 5]]) -> Self
fn composed_sum(inputs: &[Self], derivative_stacks: &[[f64; 5]]) -> Self
Source§fn affine_compose(
&self,
input_scale: f64,
input_shift: f64,
derivative_stack: [f64; 5],
) -> Self
fn affine_compose( &self, input_scale: f64, input_shift: f64, derivative_stack: [f64; 5], ) -> Self
u = input_scale * self + input_shift.Source§fn affine_composed_sum(
inputs: &[Self],
input_scales: &[f64],
derivative_stacks: &[[f64; 5]],
) -> Self
fn affine_composed_sum( inputs: &[Self], input_scales: &[f64], derivative_stacks: &[[f64; 5]], ) -> Self
Σ_i f_i(input_scale_i · (left_i · right + addend_scale_i · addend))
from the certified derivative stack of each f_i. The shared operands
make expression-level common subexpressions explicit, so optimized
backends apply their inherited derivative channels once. Expression
arity is part of the type, and borrowed operands never copy a full tower.
An exact-zero addend scale (either sign of IEEE zero) removes that addend
from the corresponding term entirely.Source§fn compose_unary_with(&self, stack_fn: impl Fn(f64) -> [f64; 5]) -> Self
fn compose_unary_with(&self, stack_fn: impl Fn(f64) -> [f64; 5]) -> Self
stack_fn. This evaluates
stack_fn(self.value()) once and forwards to
compose_unary, so it is bit-identical to the
explicit self.compose_unary(stack_fn(self.value())) form.Source§fn ln(&self) -> Self
fn ln(&self) -> Self
ln(self). Caller guarantees positivity. Same derivative stack
crate::jet_tower::Tower4::ln uses, so any program written over both
matches term-for-term.Source§fn powf(&self, a: f64) -> Self
fn powf(&self, a: f64) -> Self
self^a for real exponent a. Caller guarantees a positive base.
Mirrors crate::jet_tower::Tower4::powf (falling-factorial stack).Source§fn ln_gamma(&self) -> Self
fn ln_gamma(&self) -> Self
ln Γ(self). Caller guarantees a positive argument. Uses the SAME
hand-certified derivative stack crate::jet_tower::Tower4::ln_gamma
consumes (crate::jet_tower::ln_gamma_derivative_stack), so any
program written over both matches term-for-term.Source§fn digamma(&self) -> Self
fn digamma(&self) -> Self
ψ(self) = d/dx ln Γ(x) (digamma). Caller guarantees a positive
argument. Same hand-certified stack
crate::jet_tower::digamma_derivative_stack.Auto Trait Implementations§
impl<const K: usize> Freeze for Order1<K>
impl<const K: usize> RefUnwindSafe for Order1<K>
impl<const K: usize> Send for Order1<K>
impl<const K: usize> Sync for Order1<K>
impl<const K: usize> Unpin for Order1<K>
impl<const K: usize> UnsafeUnpin for Order1<K>
impl<const K: usize> UnwindSafe for Order1<K>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.