Skip to main content

Order2

Struct Order2 

Source
pub struct Order2<const K: usize>(pub Tower2<K>);
Expand description

Truncated SECOND-order scalar: value v, gradient g_a, Hessian H_{ab}.

This is a thin newtype over the production crate::jet_tower::Tower2, so its (v, g, H) channels are obtained by the SAME formulas — and are therefore bit-identical to both crate::jet_tower::Tower2 and the order-≤2 channels of a full crate::jet_tower::Tower4 (doc §A.1, “Bit-identity with the full tower”). The wrapper exists only to satisfy the generic JetScalar interface (the compose_unary / add / sub / neg / recip the trait demands, which Tower2 does not expose by that shape) — every channel is delegated to Tower2 arithmetic unchanged.

Tuple Fields§

§0: Tower2<K>

Implementations§

Source§

impl<const K: usize> Order2<K>

Source

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

Read the gradient channel g_a = ∂ℓ/∂p_a.

Source

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

Read the Hessian channel.

Trait Implementations§

Source§

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

Source§

type Output = Order2<K>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<const K: usize> Add<f64> for Order2<K>

Source§

type Output = Order2<K>

The resulting type after applying the + operator.
Source§

fn add(self, c: f64) -> Self

Performs the + operation. Read more
Source§

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

Source§

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

Source§

impl<const K: usize> Debug for Order2<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 Order2<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.
Source§

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

Source§

type Output = Order2<K>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<const K: usize> Mul<f64> for Order2<K>

Source§

type Output = Order2<K>

The resulting type after applying the * operator.
Source§

fn mul(self, c: f64) -> Self

Performs the * operation. Read more
Source§

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

Source§

type Output = Order2<K>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

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

Source§

type Output = Order2<K>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<const K: usize> Sub<f64> for Order2<K>

Source§

type Output = Order2<K>

The resulting type after applying the - operator.
Source§

fn sub(self, c: f64) -> Self

Performs the - operation. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<const K: usize> UnwindSafe for Order2<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> ClosedNeg for T
where T: Neg<Output = T>,

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