Skip to main content

Order2Lane

Struct Order2Lane 

Source
pub struct Order2Lane<L: Lane, const K: usize> {
    pub v: L,
    pub g: [L; K],
    pub h: [[L; K]; K],
}
Expand description

A lane-batched order-≤2 Taylor scalar: value / gradient / Hessian carried in a SIMD field L: Lane. With L = f64x4 one instance carries FOUR rows at once, so the row loop processes 4 rows per vector pass instead of one per scalar pass.

The channel layout and every float op mirror crate::jet_tower::Tower2 term-for-term, so Order2Lane<f64, K> is to_bits-identical to the production Order2<K> and Order2Lane<f64x4, K> lane i is to_bits-identical to that (see the module note and batch_tests).

Fields§

§v: L

Value channel (one entry per lane/row).

§g: [L; K]

Gradient channel ∂ℓ/∂p_a.

§h: [[L; K]; K]

Hessian channel ∂²ℓ/∂p_a∂p_b (symmetric).

Implementations§

Source§

impl<L: Lane, const K: usize> Order2Lane<L, K>

Source

pub fn constant(c: L) -> Self

A constant: value c in every channel-zero slot.

Source

pub fn variable(value: L, axis: usize) -> Self

The seeded variable p_axis at (per-lane) value value: unit first derivative in slot axis. With L = f64x4, value packs the four rows’ values of primary axis.

Source

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

Lane-wise self + o (mirrors Tower2 Add: per-channel add).

Source

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

Multiply every channel by the plain scalar s (mirrors Tower2::scale).

Source

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

Lane-wise self - o, expressed as self + o·(-1) exactly as Order2::sub / Tower4::sub do, so signed-zero handling matches.

Source

pub fn neg(&self) -> Self

Negate every channel (= scale(-1.0), matching Order2::neg).

Source

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

Exact order-≤2 Leibniz product, term-for-term identical to crate::jet_tower::Tower2::mul (same factor order, no mul_add).

Source

pub fn compose_unary(&self, d: [L; 3]) -> Self

Exact order-≤2 Faà di Bruno composition f ∘ self, given the per-lane derivative stack d = [f(u), f′(u), f″(u)]. Mirrors crate::jet_tower::Tower2::compose_unary term-for-term (acc starts at 0 then accumulates, so signed-zero collapses identically).

Source

pub fn exp(&self) -> Self

e^self, per-lane stack [e, e, e] (matches the JetScalar::exp default forwarded through Order2).

Source

pub fn ln(&self) -> Self

ln(self); caller guarantees positivity. Per-lane stack [ln u, 1/u, -1/u²] (matches JetScalar::ln truncated to order 2).

Source

pub fn sqrt(&self) -> Self

√self; caller guarantees positivity. Per-lane stack [s, 0.5/s, -0.25/(u·s)] (matches JetScalar::sqrt).

Source

pub fn recip(&self) -> Self

1/self. Per-lane stack [r, -r², 2r³] (matches JetScalar::recip).

Source

pub fn powf(&self, a: f64) -> Self

self^a for real a; caller guarantees a positive base. Per-lane falling-factorial stack (matches JetScalar::powf).

Source§

impl<const K: usize> Order2Lane<f64x4, K>

Source

pub fn lane(&self, i: usize) -> Order2<K>

Extract lane i’s (v, g, H) as a production Order2<K> scalar. Lane i is to_bits-identical to evaluating the same program at Order2<K> on row i (see batch_tests).

Trait Implementations§

Source§

impl<L: Clone + Lane, const K: usize> Clone for Order2Lane<L, K>

Source§

fn clone(&self) -> Order2Lane<L, 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<L: Copy + Lane, const K: usize> Copy for Order2Lane<L, K>

Source§

impl<L: Debug + Lane, const K: usize> Debug for Order2Lane<L, K>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<L, const K: usize> Freeze for Order2Lane<L, K>
where L: Freeze,

§

impl<L, const K: usize> RefUnwindSafe for Order2Lane<L, K>
where L: RefUnwindSafe,

§

impl<L, const K: usize> Send for Order2Lane<L, K>
where L: Send,

§

impl<L, const K: usize> Sync for Order2Lane<L, K>
where L: Sync,

§

impl<L, const K: usize> Unpin for Order2Lane<L, K>
where L: Unpin,

§

impl<L, const K: usize> UnsafeUnpin for Order2Lane<L, K>
where L: UnsafeUnpin,

§

impl<L, const K: usize> UnwindSafe for Order2Lane<L, K>
where L: 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<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