Skip to main content

NamedJet1Vec

Struct NamedJet1Vec 

Source
pub struct NamedJet1Vec<T: Passive = f64> { /* private fields */ }
Expand description

Labeled wrapper around the positional Jet1Vec type.

§Example

The constructor API for NamedJet1Vec is owned by NamedForwardTape via the declare_jet1vec / into_scope / scope.jet1vec(handle) pattern. See the module docs in src/forward_tape.rs for the full rationale.

use xad_rs::{NamedForwardTape, NamedForwardScope};

let mut ft = NamedForwardTape::new();
let x_h = ft.declare_jet1vec("x", 2.0);
let y_h = ft.declare_jet1vec("y", 3.0);
let scope: NamedForwardScope = ft.into_scope();

let x = scope.jet1vec(x_h);
let y = scope.jet1vec(y_h);
let f = x * y + x - 2.0 * y;

assert_eq!(f.real(), 2.0);
assert_eq!(f.partial("x"), 4.0);
assert_eq!(f.partial("y"), 0.0);

Implementations§

Source§

impl<T: Passive> NamedJet1Vec<T>

Source

pub fn real(&self) -> T

Value part.

Source

pub fn partial(&self, name: &str) -> T

Partial derivative with respect to a named variable.

Reads the active registry from the NamedForwardTape thread-local slot (stamped at freeze() time). Returns 0.0 if name is in the registry but not touched by this value (same as positional Jet1Vec::partial on an unused slot). Panics if name is not in the registry, or if called outside a frozen NamedForwardTape scope.

Source

pub fn gradient(&self) -> Vec<(String, T)>

Full gradient as a Vec<(name, partial)>.

Iteration order matches the active registry’s insertion order — deterministic. Reads the active registry from the thread-local slot. Panics if called outside a frozen NamedForwardTape scope.

Source

pub fn inner(&self) -> &Jet1Vec<T>

Escape hatch: direct access to the inner positional Jet1Vec.

Source

pub fn exp(&self) -> Self

Natural exponential, preserving the parent scope’s generation.

Source

pub fn ln(&self) -> Self

Natural logarithm, preserving the parent scope’s generation.

Source

pub fn sqrt(&self) -> Self

Square root, preserving the parent scope’s generation.

Source

pub fn sin(&self) -> Self

Sine, preserving the parent scope’s generation.

Source

pub fn cos(&self) -> Self

Cosine, preserving the parent scope’s generation.

Source

pub fn tan(&self) -> Self

Tangent, preserving the parent scope’s generation.

Source

pub fn norm_cdf(&self) -> Self

Standard normal CDF, preserving the parent scope’s generation.

Source

pub fn inv_norm_cdf(&self) -> Self

Inverse standard normal CDF, preserving the parent scope’s generation.

Source

pub fn powf(&self, n: T) -> Self

self^n with scalar exponent, preserving the parent scope’s generation.

Source

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

self^n with integer exponent, preserving the parent scope’s generation.

Trait Implementations§

Source§

impl<T: Passive> Add<&NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the + operation. Read more
Source§

impl<T: Passive> Add<&NamedJet1Vec<T>> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the + operation. Read more
Source§

impl Add<&NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the + operation. Read more
Source§

impl Add<&NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the + operation. Read more
Source§

impl<T: Passive> Add<NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the + operation. Read more
Source§

impl Add<NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the + operation. Read more
Source§

impl Add<NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the + operation. Read more
Source§

impl<T: Passive> Add<T> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> NamedJet1Vec<T>

Performs the + operation. Read more
Source§

impl<T: Passive> Add<T> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> NamedJet1Vec<T>

Performs the + operation. Read more
Source§

impl<T: Passive> Add for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the + operation. Read more
Source§

impl<T: Passive> AddAssign<&NamedJet1Vec<T>> for NamedJet1Vec<T>

Source§

fn add_assign(&mut self, rhs: &NamedJet1Vec<T>)

Performs the += operation. Read more
Source§

impl<T: Passive> AddAssign for NamedJet1Vec<T>

Source§

fn add_assign(&mut self, rhs: NamedJet1Vec<T>)

Performs the += operation. Read more
Source§

impl<T: Clone + Passive> Clone for NamedJet1Vec<T>

Source§

fn clone(&self) -> NamedJet1Vec<T>

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<T: Debug + Passive> Debug for NamedJet1Vec<T>

Source§

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

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

impl<T: Passive> Display for NamedJet1Vec<T>

Source§

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

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

impl<T: Passive> Div<&NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the / operation. Read more
Source§

impl<T: Passive> Div<&NamedJet1Vec<T>> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the / operation. Read more
Source§

impl Div<&NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the / operation. Read more
Source§

impl Div<&NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the / operation. Read more
Source§

impl<T: Passive> Div<NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the / operation. Read more
Source§

impl Div<NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the / operation. Read more
Source§

impl Div<NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the / operator.
Source§

fn div(self, rhs: NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the / operation. Read more
Source§

impl<T: Passive> Div<T> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> NamedJet1Vec<T>

Performs the / operation. Read more
Source§

impl<T: Passive> Div<T> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> NamedJet1Vec<T>

Performs the / operation. Read more
Source§

impl<T: Passive> Div for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the / operation. Read more
Source§

impl<T: Passive> Mul<&NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the * operation. Read more
Source§

impl<T: Passive> Mul<&NamedJet1Vec<T>> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the * operation. Read more
Source§

impl Mul<&NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the * operation. Read more
Source§

impl Mul<&NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the * operation. Read more
Source§

impl<T: Passive> Mul<NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the * operation. Read more
Source§

impl Mul<NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the * operation. Read more
Source§

impl Mul<NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the * operation. Read more
Source§

impl<T: Passive> Mul<T> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> NamedJet1Vec<T>

Performs the * operation. Read more
Source§

impl<T: Passive> Mul<T> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> NamedJet1Vec<T>

Performs the * operation. Read more
Source§

impl<T: Passive> Mul for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the * operation. Read more
Source§

impl<T: Passive> Neg for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> NamedJet1Vec<T>

Performs the unary - operation. Read more
Source§

impl<T: Passive> Neg for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> NamedJet1Vec<T>

Performs the unary - operation. Read more
Source§

impl<T: Passive> Sub<&NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the - operation. Read more
Source§

impl<T: Passive> Sub<&NamedJet1Vec<T>> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the - operation. Read more
Source§

impl Sub<&NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the - operation. Read more
Source§

impl Sub<&NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the - operation. Read more
Source§

impl<T: Passive> Sub<NamedJet1Vec<T>> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the - operation. Read more
Source§

impl Sub<NamedJet1Vec<f32>> for f32

Source§

type Output = NamedJet1Vec<f32>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NamedJet1Vec<f32>) -> NamedJet1Vec<f32>

Performs the - operation. Read more
Source§

impl Sub<NamedJet1Vec> for f64

Source§

type Output = NamedJet1Vec

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NamedJet1Vec<f64>) -> NamedJet1Vec<f64>

Performs the - operation. Read more
Source§

impl<T: Passive> Sub<T> for &NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> NamedJet1Vec<T>

Performs the - operation. Read more
Source§

impl<T: Passive> Sub<T> for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> NamedJet1Vec<T>

Performs the - operation. Read more
Source§

impl<T: Passive> Sub for NamedJet1Vec<T>

Source§

type Output = NamedJet1Vec<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: NamedJet1Vec<T>) -> NamedJet1Vec<T>

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for NamedJet1Vec<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for NamedJet1Vec<T>
where T: RefUnwindSafe,

§

impl<T> Send for NamedJet1Vec<T>

§

impl<T> Sync for NamedJet1Vec<T>

§

impl<T> Unpin for NamedJet1Vec<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for NamedJet1Vec<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for NamedJet1Vec<T>
where T: 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.