Jet

Struct Jet 

Source
pub(crate) struct Jet<const N: usize> {
    pub(crate) value: Complex,
    pub(crate) derivative: [Complex; N],
}
Expand description

A complex value and its first derivatives with respect to N inputs.

Kernels that are generic in N serve forward evaluation and differentiation alike. With N = 0 the derivative array is empty, so a forward evaluation stores and computes no derivatives. Operations with a real or complex scalar skip the zero derivative terms of a constant jet. Adding or subtracting a scalar still gives the value a constant jet gives, signed zeros included: the sign of a zero imaginary part selects the side of a branch cut downstream. special::RadialJet differs: it holds the first two derivatives in one variable.

Fields§

§value: Complex

The function value.

§derivative: [Complex; N]

The derivative with respect to each of the N inputs.

Implementations§

Source§

impl<const N: usize> Jet<N>

Source

pub(crate) fn constant(value: impl Into<Complex>) -> Self

A value that depends on no input: every derivative is zero.

Source

pub(crate) fn variable(value: impl Into<Complex>, index: usize) -> Self

Input number index itself: derivative one in that direction, zero in the others. An index of N or more gives a constant.

Source

pub(crate) fn chain(self, value: Complex, derivative: Complex) -> Self

The chain rule: the jet of f(self) from value = f(x) and derivative = f'(x) at x = self.value. Each derivative of self is multiplied by f'(x).

Source

pub(crate) fn powi(self, n: i32) -> Self

Integer power self^n.

Source

pub(crate) fn exp(self) -> Self

Complex exponential.

Source

pub(crate) fn sqrt(self) -> Self

Principal square root, with the branch of numerics::complex_sqrt.

Source

pub(crate) fn norm(self) -> f64

The largest modulus of the value and the derivatives.

Source

pub(crate) fn finite(self) -> bool

Whether the value and every derivative are finite.

Source

pub(crate) fn is_zero(self) -> bool

Whether the value and every derivative are zero, without the moduli of norm.

Source§

impl Jet<3>

Source

pub(crate) fn compose<const N: usize>(self, inner: [Jet<N>; 3]) -> Jet<N>

The chain rule through three intermediate variables: self holds f and its derivatives with respect to x_b, inner[b] holds x_b and its derivatives with respect to N inputs. Returns the value of f with the derivatives sum_b df/dx_b dx_b/dt_a, summed in the order b = 0, 1, 2.

Trait Implementations§

Source§

impl<const N: usize> Add<Complex<f64>> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Complex) -> Self

Performs the + operation. Read more
Source§

impl<const N: usize> Add<Jet<N>> for Complex

Source§

type Output = Jet<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Jet<N>) -> Jet<N>

Performs the + operation. Read more
Source§

impl<const N: usize> Add<Jet<N>> for f64

Source§

type Output = Jet<N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Jet<N>) -> Jet<N>

Performs the + operation. Read more
Source§

impl<const N: usize> Add<f64> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<const N: usize> Add for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<const N: usize, Rhs> AddAssign<Rhs> for Jet<N>
where Self: Add<Rhs, Output = Self>,

Source§

fn add_assign(&mut self, rhs: Rhs)

Performs the += operation. Read more
Source§

impl<const N: usize> Clone for Jet<N>

Source§

fn clone(&self) -> Jet<N>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<const N: usize> Debug for Jet<N>

Source§

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

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

impl<const N: usize> Default for Jet<N>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const N: usize> Div<Complex<f64>> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Complex) -> Self

Performs the / operation. Read more
Source§

impl<const N: usize> Div<Jet<N>> for Complex

Source§

type Output = Jet<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Jet<N>) -> Jet<N>

Performs the / operation. Read more
Source§

impl<const N: usize> Div<Jet<N>> for f64

Source§

type Output = Jet<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Jet<N>) -> Jet<N>

Performs the / operation. Read more
Source§

impl<const N: usize> Div<f64> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self

Performs the / operation. Read more
Source§

impl<const N: usize> Div for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<const N: usize> Mul<Complex<f64>> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Complex) -> Self

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Jet<N>> for Complex

Source§

type Output = Jet<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Jet<N>) -> Jet<N>

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<Jet<N>> for f64

Source§

type Output = Jet<N>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Jet<N>) -> Jet<N>

Performs the * operation. Read more
Source§

impl<const N: usize> Mul<f64> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<const N: usize> Mul for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<const N: usize, Rhs> MulAssign<Rhs> for Jet<N>
where Self: Mul<Rhs, Output = Self>,

Source§

fn mul_assign(&mut self, rhs: Rhs)

Performs the *= operation. Read more
Source§

impl<const N: usize> Neg for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<const N: usize> Sub<Complex<f64>> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Complex) -> Self

Performs the - operation. Read more
Source§

impl<const N: usize> Sub<Jet<N>> for Complex

Source§

type Output = Jet<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Jet<N>) -> Jet<N>

Performs the - operation. Read more
Source§

impl<const N: usize> Sub<Jet<N>> for f64

Source§

type Output = Jet<N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Jet<N>) -> Jet<N>

Performs the - operation. Read more
Source§

impl<const N: usize> Sub<f64> for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<const N: usize> Sub for Jet<N>

Source§

type Output = Jet<N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<const N: usize, Rhs> SubAssign<Rhs> for Jet<N>
where Self: Sub<Rhs, Output = Self>,

Source§

fn sub_assign(&mut self, rhs: Rhs)

Performs the -= operation. Read more
Source§

impl<const N: usize> Sum for Jet<N>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<const N: usize> Copy for Jet<N>

Auto Trait Implementations§

§

impl<const N: usize> Freeze for Jet<N>

§

impl<const N: usize> RefUnwindSafe for Jet<N>

§

impl<const N: usize> Send for Jet<N>

§

impl<const N: usize> Sync for Jet<N>

§

impl<const N: usize> Unpin for Jet<N>

§

impl<const N: usize> UnwindSafe for Jet<N>

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
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

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

§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

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

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,