Struct dual_num::DualNumber [] [src]

pub struct DualNumber<T>(_, _);

Dual Number structure

Although DualNumber 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 DualNumber, and will panic.

Methods

impl<T> DualNumber<T>
[src]

[src]

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

[src]

Create a new dual number from a real number.

The dual part is set to zero.

[src]

Returns both real and dual parts as a tuple

Important traits for &'a mut W
[src]

Returns a reference to the real part

Important traits for &'a mut W
[src]

Returns a reference to the dual part

Important traits for &'a mut W
[src]

Returns a mutable reference to the real part

Important traits for &'a mut W
[src]

Returns a mutable reference to the dual part

[src]

Convenience method to take a closure (or any function) that can operate on the dual number in place

[src]

Convenience method to take a closure (or any function) that can operate on the dual number parts in place

impl<T: Copy> DualNumber<T>
[src]

[src]

Returns the real part

[src]

Returns the dual part

impl<T: Float> DualNumber<T>
[src]

[src]

Returns the conjugate of the dual number.

Trait Implementations

impl<T: Debug> Debug for DualNumber<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: Clone> Clone for DualNumber<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Copy> Copy for DualNumber<T>
[src]

impl<T: Zero> From<T> for DualNumber<T>
[src]

[src]

Performs the conversion.

impl<T: Display> Display for DualNumber<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: PartialEq> PartialEq<Self> for DualNumber<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<T: PartialOrd> PartialOrd<Self> for DualNumber<T>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

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

[src]

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

[src]

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

[src]

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

impl<T: PartialEq> PartialEq<T> for DualNumber<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<T: PartialOrd> PartialOrd<T> for DualNumber<T>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

[src]

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

[src]

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

[src]

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

[src]

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

impl<T: ToPrimitive> ToPrimitive for DualNumber<T>
[src]

[src]

Converts the value of self to an isize.

[src]

Converts the value of self to an i8.

[src]

Converts the value of self to an i16.

[src]

Converts the value of self to an i32.

[src]

Converts the value of self to an i64.

[src]

Converts the value of self to a usize.

[src]

Converts the value of self to an u8.

[src]

Converts the value of self to an u16.

[src]

Converts the value of self to an u32.

[src]

Converts the value of self to an u64.

[src]

Converts the value of self to an f32.

[src]

Converts the value of self to an f64.

impl<T: FromPrimitive> FromPrimitive for DualNumber<T> where
    T: Zero
[src]

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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

impl<T: Num + Copy> Add<T> for DualNumber<T>
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<T: Num + Copy> Sub<T> for DualNumber<T>
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<T: Num + Copy> Mul<T> for DualNumber<T>
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<T: Num + Copy> Div<T> for DualNumber<T>
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<T: Signed + Copy> Neg for DualNumber<T>
[src]

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

impl<T: Num + Copy> Add<Self> for DualNumber<T>
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<T: Num + Copy> Sub<Self> for DualNumber<T>
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<T: Num + Copy> Mul<Self> for DualNumber<T>
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<T: Num + Copy> Div<Self> for DualNumber<T>
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl<T: Num + Copy> Rem<Self> for DualNumber<T>
[src]

The resulting type after applying the % operator.

[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> Signed for DualNumber<T> where
    T: Signed + Copy + PartialOrd
[src]

[src]

Computes the absolute value. Read more

[src]

The positive difference of two numbers. Read more

[src]

Returns the sign of the number. Read more

[src]

Returns true if the number is positive and false if the number is zero or negative.

[src]

Returns true if the number is negative and false if the number is zero or positive.

impl<T: Unsigned> Unsigned for DualNumber<T> where
    Self: Num
[src]

impl<T: Num + Zero + Copy> Zero for DualNumber<T>
[src]

[src]

Returns the additive identity element of Self, 0. Read more

[src]

Returns true if self is equal to the additive identity.

impl<T: Num + One + Copy> One for DualNumber<T>
[src]

[src]

Returns the multiplicative identity element of Self, 1. Read more

[src]

Returns true if self is equal to the multiplicative identity. Read more

impl<T: Num + Copy> Num for DualNumber<T>
[src]

[src]

Convert from a string and radix <= 36. Read more

impl<T: Float> NumCast for DualNumber<T>
[src]

[src]

Creates a number from another value that can be converted into a primitive via the ToPrimitive trait. Read more

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

[src]

Return Euler’s number.

[src]

Return 1.0 / π.

[src]

Return 1.0 / sqrt(2.0).

[src]

Return 2.0 / π.

[src]

Return 2.0 / sqrt(π).

[src]

Return π / 2.0.

[src]

Return π / 3.0.

[src]

Return π / 4.0.

[src]

Return π / 6.0.

[src]

Return π / 8.0.

[src]

Return ln(10.0).

[src]

Return ln(2.0).

[src]

Return log10(e).

[src]

Return log2(e).

[src]

Return Archimedes’ constant.

[src]

Return sqrt(2.0).

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

[src]

Returns the NaN value. Read more

[src]

Returns the infinite value. Read more

[src]

Returns the negative infinite value. Read more

[src]

Returns -0.0. Read more

[src]

Returns the smallest positive, normalized value that this type can represent. Read more

[src]

Returns epsilon, a small positive value. Read more

[src]

Returns the smallest finite value that this type can represent. Read more

[src]

Returns the largest finite value that this type can represent. Read more

[src]

Returns true if this value is NaN and false otherwise. Read more

[src]

Returns true if this value is positive infinity or negative infinity and false otherwise. Read more

[src]

Returns true if this number is neither infinite nor NaN. Read more

[src]

Returns true if the number is neither zero, infinite, [subnormal][subnormal], or NaN. Read more

[src]

Returns true if self is positive, including +0.0, Float::infinity(), and since Rust 1.20 also Float::nan(). Read more

[src]

Returns true if self is negative, including -0.0, Float::neg_infinity(), and since Rust 1.20 also -Float::nan(). Read more

[src]

Returns the floating point category of the number. If only one property is going to be tested, it is generally faster to use the specific predicate instead. Read more

[src]

Returns the largest integer less than or equal to a number. Read more

[src]

Returns the smallest integer greater than or equal to a number. Read more

[src]

Returns the nearest integer to a number. Round half-way cases away from 0.0. Read more

[src]

Return the integer part of a number. Read more

[src]

Returns the fractional part of a number. Read more

[src]

Returns a number that represents the sign of self. Read more

[src]

Computes the absolute value of self. Returns Float::nan() if the number is Float::nan(). Read more

[src]

Returns the maximum of the two numbers. Read more

[src]

Returns the minimum of the two numbers. Read more

[src]

The positive difference of two numbers. Read more

[src]

Fused multiply-add. Computes (self * a) + b with only one rounding error. This produces a more accurate result with better performance than a separate multiplication operation followed by an add. Read more

[src]

Take the reciprocal (inverse) of a number, 1/x. Read more

[src]

Raise a number to an integer power. Read more

[src]

Raise a number to a floating point power. Read more

[src]

Returns e^(self), (the exponential function). Read more

[src]

Returns 2^(self). Read more

[src]

Returns the natural logarithm of the number. Read more

[src]

Returns the logarithm of the number with respect to an arbitrary base. Read more

[src]

Returns the base 2 logarithm of the number. Read more

[src]

Returns the base 10 logarithm of the number. Read more

[src]

Take the square root of a number. Read more

[src]

Take the cubic root of a number. Read more

[src]

Calculate the length of the hypotenuse of a right-angle triangle given legs of length x and y. Read more

[src]

Computes the sine of a number (in radians). Read more

[src]

Computes the cosine of a number (in radians). Read more

[src]

Computes the tangent of a number (in radians). Read more

[src]

Computes the arcsine of a number. Return value is in radians in the range [-pi/2, pi/2] or NaN if the number is outside the range [-1, 1]. Read more

[src]

Computes the arccosine of a number. Return value is in radians in the range [0, pi] or NaN if the number is outside the range [-1, 1]. Read more

[src]

Computes the arctangent of a number. Return value is in radians in the range [-pi/2, pi/2]; Read more

[src]

Computes the four quadrant arctangent of self (y) and other (x). Read more

[src]

Simultaneously computes the sine and cosine of the number, x. Returns (sin(x), cos(x)). Read more

[src]

Returns e^(self) - 1 in a way that is accurate even if the number is close to zero. Read more

[src]

Returns ln(1+n) (natural logarithm) more accurately than if the operations were performed separately. Read more

[src]

Hyperbolic sine function. Read more

[src]

Hyperbolic cosine function. Read more

[src]

Hyperbolic tangent function. Read more

[src]

Inverse hyperbolic sine function. Read more

[src]

Inverse hyperbolic cosine function. Read more

[src]

Inverse hyperbolic tangent function. Read more

[src]

Returns the mantissa, base 2 exponent, and sign as integers, respectively. The original number can be recovered by sign * mantissa * 2 ^ exponent. Read more

[src]

Converts radians to degrees. Read more

[src]

Converts degrees to radians. Read more

Auto Trait Implementations

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

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