Skip to main content

TwoSeed

Struct TwoSeed 

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

Two-seed scalar: an Order2 base plus TWO nilpotents ε, δ (ε² = δ² = 0, εδ retained) — four Order2 parts s = base + ε·eps + δ·del + εδ·eps_del.

Product truncates ε² = δ² = 0 (doc §A.3): each part is built from Order2 products of the four input parts. Composition picks up successively higher outer derivatives, the cross part carrying the second Faà di Bruno term f''·eps·del + f'·eps_del.

Seed each primary with seed: base = variable(x, axis), eps = constant(u_axis), del = constant(v_axis), eps_del = constant(0). Then the εδ-component of the evaluated Hessian channel is the contracted fourth [eps_del.h][a][b] = Σ_{cd} ℓ_{abcd} u_c v_d — exactly row_fourth_contracted(u, v), without materialising t4.

Fields§

§base: Order2<K>

The ε⁰δ⁰ part: value / grad / Hessian of .

§eps: Order2<K>

The ε¹δ⁰ part.

§del: Order2<K>

The ε⁰δ¹ part.

§eps_del: Order2<K>

The ε¹δ¹ part. After a seed(u, v) evaluation, eps_del.h[a][b] = Σ_{cd} ℓ_{abcd} u_c v_d.

Implementations§

Source§

impl<const K: usize> TwoSeed<K>

Source

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

Seed primary axis at value x with ε-direction u_axis and δ-direction v_axis: p_axis = p_axis⁰ + x-seed + ε·u_axis + δ·v_axis (doc §A.3 “Seeding”).

Source

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

The contracted-fourth channel after a seed(u, v) evaluation: out[a][b] = Σ_{cd} ℓ_{abcd} u_c v_d, i.e. the εδ-coefficient’s Hessian.

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> TwoSeed<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 TwoSeed<K>

Source§

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

Source§

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

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

impl<const K: usize> JetScalar<K> for TwoSeed<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 value(&self) -> f64

The value channel ℓ(p).
Source§

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

Exact truncated Leibniz sum self + o.
Source§

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

Exact truncated Leibniz difference self − o.
Source§

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

Exact truncated Leibniz product self · o.
Source§

fn neg(&self) -> Self

Negate every channel.
Source§

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

Multiply every channel by a plain scalar s.
Source§

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

Exact multivariate Faà di Bruno composition f ∘ self, given the outer derivative stack d = [f(u), f′(u), f″(u), f‴(u), f⁗(u)] at u = self.value(). Read more
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 TwoSeed<K>

§

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

§

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

§

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

§

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

§

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

§

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V