[][src]Struct dual_num::Dual

pub struct Dual<T: Scalar>(_);

Dual Number structure

Although Dual does implement PartialEq and PartialOrd, it only compares the real part.

Additionally, min and max only compare the real parts, and keep the dual parts.

Lastly, the Rem remainder operator is not correctly or fully defined for Dual, and will panic.

Methods

impl<T: Scalar> Dual<T>[src]

pub fn new(real: T, dual: T) -> Dual<T>[src]

Create a new dual number from its real and dual parts.

pub fn from_real(real: T) -> Dual<T> where
    T: Zero
[src]

Create a new dual number from a real number.

The dual part is set to zero.

pub fn real(&self) -> T[src]

Returns the real part

pub fn dual(&self) -> T[src]

Returns the dual part

pub fn into_tuple(self) -> (T, T)[src]

Returns both real and dual parts as a tuple

pub fn real_ref(&self) -> &T[src]

Returns a reference to the real part

pub fn dual_ref(&self) -> &T[src]

Returns a reference to the dual part

pub fn real_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the real part

pub fn dual_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the dual part

impl<T: Scalar + Neg<Output = T>> Dual<T>[src]

pub fn conjugate(self) -> Self[src]

Returns the conjugate of the dual number.

Trait Implementations

impl<T: Scalar + PartialOrd> PartialOrd<Dual<T>> for Dual<T>[src]

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Scalar + PartialOrd> PartialOrd<T> for Dual<T>[src]

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Scalar> AsMut<Matrix<T, U2, U1, <DefaultAllocator as Allocator<T, U2, U1>>::Buffer>> for Dual<T>[src]

impl<T: Copy + Scalar> Copy for Dual<T>[src]

impl<T: Scalar + PartialEq> PartialEq<Dual<T>> for Dual<T>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T: Scalar + PartialEq> PartialEq<T> for Dual<T>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<T: Scalar> AsRef<Matrix<T, U2, U1, <DefaultAllocator as Allocator<T, U2, U1>>::Buffer>> for Dual<T>[src]

impl<T: Scalar + Zero> Default for Dual<T>[src]

impl<T: Scalar + Zero> From<T> for Dual<T>[src]

impl<T: Clone + Scalar> Clone for Dual<T>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Scalar> DerefMut for Dual<T>[src]

impl<T: Scalar + Display> Display for Dual<T>[src]

impl<T: Scalar> Debug for Dual<T>[src]

impl<T: Scalar + Num> Sub<T> for Dual<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: Scalar + Num> Sub<Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: Scalar + Num> Add<T> for Dual<T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: Scalar + Num> Add<Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: Scalar + Num> Mul<T> for Dual<T>[src]

type Output = Self

The resulting type after applying the * operator.

impl<T: Scalar + Num> Mul<Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the * operator.

impl<T: Scalar + Num> Div<T> for Dual<T>[src]

type Output = Self

The resulting type after applying the / operator.

impl<T: Scalar + Num> Div<Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the / operator.

impl<T: Scalar + Num> Rem<Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the % operator.

fn rem(self, _: Self) -> Self[src]

UNIMPLEMENTED!!!

As far as I know, remainder is not a valid operation on dual numbers, but is required for the Float trait to be implemented.

impl<T: Scalar + Signed> Neg for Dual<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: Scalar + Num> AddAssign<T> for Dual<T>[src]

impl<T: Scalar + Num> AddAssign<Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num> SubAssign<T> for Dual<T>[src]

impl<T: Scalar + Num> SubAssign<Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num> MulAssign<T> for Dual<T>[src]

impl<T: Scalar + Num> MulAssign<Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num> DivAssign<T> for Dual<T>[src]

impl<T: Scalar + Num> DivAssign<Dual<T>> for Dual<T>[src]

impl<T: Scalar> Deref for Dual<T>[src]

type Target = Vector2<T>

The resulting type after dereferencing.

impl<T: Scalar + Num + Zero> Sum<Dual<T>> for Dual<T>[src]

impl<'a, T: Scalar + Num + Zero> Sum<&'a Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num + One> Product<Dual<T>> for Dual<T>[src]

impl<'a, T: Scalar + Num + One> Product<&'a Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num + Zero> Zero for Dual<T>[src]

impl<T: Scalar> Signed for Dual<T> where
    T: Signed + PartialOrd
[src]

impl<T: Scalar + Num + One> One for Dual<T>[src]

impl<T: Scalar + ToPrimitive> ToPrimitive for Dual<T>[src]

fn to_i128(&self) -> Option<i128>[src]

Converts the value of self to an i128. Read more

fn to_u128(&self) -> Option<u128>[src]

Converts the value of self to an u128. Read more

impl<T: Scalar + FromPrimitive> FromPrimitive for Dual<T> where
    T: Zero
[src]

fn from_i128(n: i128) -> Option<Self>[src]

Convert an i128 to return an optional value of this type. If the type cannot be represented by this value, then None is returned. Read more

fn from_u128(n: u128) -> Option<Self>[src]

Convert an u128 to return an optional value of this type. If the type cannot be represented by this value, then None is returned. Read more

impl<T: Scalar + Float> NumCast for Dual<T>[src]

impl<T: Scalar> Float for Dual<T> where
    T: Float + Signed + FloatConst
[src]

impl<T: Scalar + FloatConst + Zero> FloatConst for Dual<T>[src]

impl<T: Scalar + Num> Num for Dual<T>[src]

type FromStrRadixErr = <T as Num>::FromStrRadixErr

impl<T: Scalar> Inv for Dual<T> where
    Self: One + Div<Output = Self>, 
[src]

type Output = Self

The result after applying the operator.

impl<T: Scalar + Num + Mul + Add> MulAdd<Dual<T>, Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the fused multiply-add.

impl<T: Scalar + Num + Mul + Add> MulAdd<T, Dual<T>> for Dual<T>[src]

type Output = Self

The resulting type after applying the fused multiply-add.

impl<T: Scalar + Num + Mul + Add> MulAdd<Dual<T>, T> for Dual<T>[src]

type Output = Self

The resulting type after applying the fused multiply-add.

impl<T: Scalar + Num + Mul + Add> MulAdd<T, T> for Dual<T>[src]

type Output = Self

The resulting type after applying the fused multiply-add.

impl<T: Scalar + Num + Mul + Add> MulAddAssign<Dual<T>, Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num + Mul + Add> MulAddAssign<T, Dual<T>> for Dual<T>[src]

impl<T: Scalar + Num + Mul + Add> MulAddAssign<Dual<T>, T> for Dual<T>[src]

impl<T: Scalar + Num + Mul + Add> MulAddAssign<T, T> for Dual<T>[src]

impl<T: Scalar, P: Into<Dual<T>>> Pow<P> for Dual<T> where
    Dual<T>: Float
[src]

type Output = Self

The result after applying the operator.

impl<T: Scalar + Unsigned> Unsigned for Dual<T> where
    Self: Num
[src]

Auto Trait Implementations

impl<T> Send for Dual<T> where
    T: Send

impl<T> Sync for Dual<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Any + Debug
[src]

fn is<T>() -> bool where
    T: Scalar
[src]

Tests if Self the same as the type T Read more

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

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

impl<T> Same for T

type Output = T

Should always be Self

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

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

impl<T, Right> ClosedDiv for T where
    T: Div<Right, Output = T> + DivAssign<Right>, 

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

impl<T> Real for T where
    T: Float
[src]

impl<T, Rhs, Output> NumOps for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]