Skip to main content

OneSeed

Struct OneSeed 

Source
pub struct OneSeed<const K: usize> {
    pub base: Order2<K>,
    pub eps: Order2<K>,
}
Expand description

One-seed directional scalar: an Order2 base plus ONE nilpotent ε (ε² = 0) whose coefficient is itself an Order2.

A scalar is s = base + ε·eps. Arithmetic is the ε² = 0 truncation of the product (doc §A.2): the base parts multiply as ordinary Order2 products, and the ε-coefficient picks up a.base·b.eps + a.eps·b.base. Composition pushes ε through one extra outer derivative.

Seed each primary with seed_direction: the base is the usual seeded variable (carrying e_a for the Hessian channel) and the ε-coefficient is the FIXED contraction direction u_a (a constant). Then the ε-component of the evaluated Hessian channel is the contracted third [eps.h][a][b] = Σ_c ℓ_{abc} u_c — exactly row_third_contracted(dir = u), without materialising t3.

Fields§

§base: Order2<K>

The ε⁰ part: value / gradient / Hessian of .

§eps: Order2<K>

The ε¹ part: value / gradient / Hessian of the ε-coefficient. After a seed_direction(u) evaluation, eps.h[a][b] = Σ_c ℓ_{abc} u_c.

Implementations§

Source§

impl<const K: usize> OneSeed<K>

Source

pub fn seed_direction(x: f64, axis: usize, u_axis: f64) -> Self

Seed primary axis at value x with ε-direction component u_axis: p_axis = p_axis⁰ + x-seed + ε·u_axis, i.e. base = variable(x, axis) and eps = constant(u_axis) (doc §A.2 “Seeding”).

Source

pub fn contracted_third(&self) -> [[f64; K]; K]

The contracted-third channel after a seed_direction(u) evaluation: out[a][b] = Σ_c ℓ_{abc} u_c, i.e. the ε-coefficient’s Hessian (doc §A.2).

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> OneSeed<K>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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

Source§

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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

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.
Source§

fn constant_like(&self, v: f64) -> Self

A constant carrying THIS element’s shape: real value v, every derivative channel zero. Read more
Source§

fn with_value(&self, v: f64) -> Self

self with its real value channel replaced by v, every derivative channel untouched. Read more
Source§

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

Source§

fn constant(c: f64) -> Self

A constant: value c, every derivative channel zero.
Source§

fn variable(x: f64, axis: usize) -> Self

The seeded variable 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

Evaluate 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

Evaluate sum_i weights[i] * inputs[i] in one semantic primitive.
Source§

fn add_constant(&self, constant: f64) -> Self

Add a primal constant without changing derivative channels.
Source§

fn multiply_add(&self, right: &Self, addend: &Self) -> Self

Evaluate self * right + addend in one semantic primitive.
Source§

fn composed_sum(inputs: &[Self], derivative_stacks: &[[f64; 5]]) -> Self

Sum unary compositions directly from certified derivative stacks.
Source§

fn product(&self, right: &Self) -> Self

Exact product as an explicit compiled graph node.
Source§

fn affine_compose( &self, input_scale: f64, input_shift: f64, derivative_stack: [f64; 5], ) -> Self

Compose a certified outer stack after the affine map u = input_scale * self + input_shift.
Source§

fn affine_composed_sum( inputs: &[Self], input_scales: &[f64], derivative_stacks: &[[f64; 5]], ) -> Self

Sum unary compositions whose inputs each carry an affine scale.
Source§

fn shared_multiply_add_affine_composed_sum<const N: usize>( lefts: &[&Self; N], right: &Self, addend: &Self, addend_scales: &[f64; N], input_scales: &[f64; N], derivative_stacks: &[[f64; 5]; N], ) -> Self

Evaluate Σ_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

Compose with a unary special-function whose derivative stack is built from the scalar base value through 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 exp(&self) -> Self

e^self. Convenience for tame arguments (see module stability note).
Source§

fn sqrt(&self) -> Self

√self. Caller guarantees positivity.
Source§

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 recip(&self) -> Self

1/self.
Source§

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

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

ψ(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 OneSeed<K>
where Order2<K>: Freeze,

§

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

§

impl<const K: usize> Send for OneSeed<K>
where Order2<K>: Send,

§

impl<const K: usize> Sync for OneSeed<K>
where Order2<K>: Sync,

§

impl<const K: usize> Unpin for OneSeed<K>
where Order2<K>: Unpin,

§

impl<const K: usize> UnsafeUnpin for OneSeed<K>
where Order2<K>: UnsafeUnpin,

§

impl<const K: usize> UnwindSafe for OneSeed<K>
where Order2<K>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.