Skip to main content

JetField

Trait JetField 

Source
pub trait JetField {
    // Required methods
    fn value(&self) -> f64;
    fn add(&self, o: &Self) -> Self;
    fn sub(&self, o: &Self) -> Self;
    fn mul(&self, o: &Self) -> Self;
    fn neg(&self) -> Self;
    fn scale(&self, s: f64) -> Self;
    fn compose_unary(&self, d: [f64; 5]) -> Self;
}
Expand description

Minimal scalar field a Dual2 can be built over. Implemented by f64 (the base case) and by Dual2 itself (the nesting case). Every operation mirrors the crate::jet_tower::Tower4 / crate::jet_scalar::JetScalar Faà di Bruno convention exactly, so a program written against JetField evaluates identically on the engine tower and on a nested dual.

This is the SHARED scalar-field algebra base of the #932 tower: the const-K packed crate::jet_scalar::JetScalar and the runtime-p Vec-backed flex jets (survival::marginal_slope::timepoint_exact::FlexJet) both EXTEND it, so the field ops and the single Faà di Bruno composition are declared exactly ONCE here. It is deliberately NOT Copy (the Vec-backed flex jets are Clone, not Copy) and carries no constructor (a Vec-backed constant needs a primary count) — the Copy, from_f64-carrying nested-dual oracle path adds those through JetFieldConst.

Required Methods§

Source

fn value(&self) -> f64

The real value channel (recurses through any nesting to the f64 leaf).

Source

fn add(&self, o: &Self) -> Self

Source

fn sub(&self, o: &Self) -> Self

Source

fn mul(&self, o: &Self) -> Self

Source

fn neg(&self) -> Self

Source

fn scale(&self, s: f64) -> Self

Multiply every channel by a plain f64.

Source

fn compose_unary(&self, d: [f64; 5]) -> Self

Faà di Bruno composition 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.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl JetField for f64

Source§

fn value(&self) -> f64

Source§

fn add(&self, o: &Self) -> Self

Source§

fn sub(&self, o: &Self) -> Self

Source§

fn mul(&self, o: &Self) -> Self

Source§

fn neg(&self) -> Self

Source§

fn scale(&self, s: f64) -> Self

Source§

fn compose_unary(&self, d: [f64; 5]) -> Self

Implementors§

Source§

impl<P, const K: usize, const H: usize> JetField for PatternedOrder2<P, K, H>
where P: HessianPattern<K, H>,

Source§

impl<S: JetField> JetField for Dual2<S>

Source§

impl<const K: usize> JetField for OneSeed<K>

Source§

impl<const K: usize> JetField for Order1<K>

Source§

impl<const K: usize> JetField for Order2<K>

Source§

impl<const K: usize> JetField for Tower3<K>

Source§

impl<const K: usize> JetField for Tower4<K>

Source§

impl<const K: usize> JetField for TwoSeed<K>