Struct num_complex::Complex [] [src]

pub struct Complex<T> {
    pub re: T,
    pub im: T,
}

A complex number in Cartesian form.

Fields

Real portion of the complex number

Imaginary portion of the complex number

Methods

impl<T: Clone + Num> Complex<T>
[src]

Create a new Complex

Returns imaginary unit

Returns the square of the norm (since T doesn't necessarily have a sqrt function), i.e. re^2 + im^2.

Multiplies self by the scalar t.

Divides self by the scalar t.

impl<T: Clone + Num + Neg<Output=T>> Complex<T>
[src]

Returns the complex conjugate. i.e. re - i im

Returns 1/self

impl<T: Clone + Float> Complex<T>
[src]

Calculate |self|

Calculate the principal Arg of self.

Convert to polar form (r, theta), such that self = r * exp(i * theta)

Convert a polar representation into a complex number.

Computes e^(self), where e is the base of the natural logarithm.

Computes the principal value of natural logarithm of self.

This function has one branch cut:

  • (-∞, 0], continuous from above.

The branch satisfies -π ≤ arg(ln(z)) ≤ π.

Computes the principal value of the square root of self.

This function has one branch cut:

  • (-∞, 0), continuous from above.

The branch satisfies -π/2 ≤ arg(sqrt(z)) ≤ π/2.

Raises self to a floating point power.

Returns the logarithm of self with respect to an arbitrary base.

Raises self to a complex power.

Raises a floating point number to the complex power self.

Computes the sine of self.

Computes the cosine of self.

Computes the tangent of self.

Computes the principal value of the inverse sine of self.

This function has two branch cuts:

  • (-∞, -1), continuous from above.
  • (1, ∞), continuous from below.

The branch satisfies -π/2 ≤ Re(asin(z)) ≤ π/2.

Computes the principal value of the inverse cosine of self.

This function has two branch cuts:

  • (-∞, -1), continuous from above.
  • (1, ∞), continuous from below.

The branch satisfies 0 ≤ Re(acos(z)) ≤ π.

Computes the principal value of the inverse tangent of self.

This function has two branch cuts:

  • (-∞i, -i], continuous from the left.
  • [i, ∞i), continuous from the right.

The branch satisfies -π/2 ≤ Re(atan(z)) ≤ π/2.

Computes the hyperbolic sine of self.

Computes the hyperbolic cosine of self.

Computes the hyperbolic tangent of self.

Computes the principal value of inverse hyperbolic sine of self.

This function has two branch cuts:

  • (-∞i, -i), continuous from the left.
  • (i, ∞i), continuous from the right.

The branch satisfies -π/2 ≤ Im(asinh(z)) ≤ π/2.

Computes the principal value of inverse hyperbolic cosine of self.

This function has one branch cut:

  • (-∞, 1), continuous from above.

The branch satisfies -π ≤ Im(acosh(z)) ≤ π and 0 ≤ Re(acosh(z)) < ∞.

Computes the principal value of inverse hyperbolic tangent of self.

This function has two branch cuts:

  • (-∞, -1], continuous from above.
  • [1, ∞), continuous from below.

The branch satisfies -π/2 ≤ Im(atanh(z)) ≤ π/2.

Checks if the given complex number is NaN

Checks if the given complex number is infinite

Checks if the given complex number is finite

Checks if the given complex number is normal

Trait Implementations

impl<T: Encodable> Encodable for Complex<T>
[src]

impl<T: Decodable> Decodable for Complex<T>
[src]

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

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

This method tests for !=.

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T: Hash> Hash for Complex<T>
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

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

Formats the value using the given formatter.

impl<T: Default> Default for Complex<T>
[src]

Returns the "default value" for a type. Read more

impl<T: Clone + Num> From<T> for Complex<T>
[src]

Performs the conversion.

impl<'a, T: Clone + Num> From<&'a T> for Complex<T>
[src]

Performs the conversion.

impl<'a, 'b, T: Clone + Num> Add<&'b Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, T: Clone + Num> Add<Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, T: Clone + Num> Add<&'a Complex<T>> for Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<T: Clone + Num> Add<Complex<T>> for Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T: Clone + Num> Sub<&'b Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, T: Clone + Num> Sub<Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, T: Clone + Num> Sub<&'a Complex<T>> for Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<T: Clone + Num> Sub<Complex<T>> for Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T: Clone + Num> Mul<&'b Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, T: Clone + Num> Mul<Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, T: Clone + Num> Mul<&'a Complex<T>> for Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<T: Clone + Num> Mul<Complex<T>> for Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T: Clone + Num> Div<&'b Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, T: Clone + Num> Div<Complex<T>> for &'a Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, T: Clone + Num> Div<&'a Complex<T>> for Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<T: Clone + Num> Div<Complex<T>> for Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<T: Clone + Num + Neg<Output=T>> Neg for Complex<T>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<'a, T: Clone + Num + Neg<Output=T>> Neg for &'a Complex<T>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<'a, T: Clone + Num> Add<&'a T> for Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, T: Clone + Num> Add<T> for &'a Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T: Clone + Num> Add<&'a T> for &'b Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, T: Clone + Num> Sub<&'a T> for Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, T: Clone + Num> Sub<T> for &'a Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T: Clone + Num> Sub<&'a T> for &'b Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, T: Clone + Num> Mul<&'a T> for Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, T: Clone + Num> Mul<T> for &'a Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T: Clone + Num> Mul<&'a T> for &'b Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, T: Clone + Num> Div<&'a T> for Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, T: Clone + Num> Div<T> for &'a Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b, T: Clone + Num> Div<&'a T> for &'b Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<T: Clone + Num> Add<T> for Complex<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<T: Clone + Num> Sub<T> for Complex<T>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<T: Clone + Num> Mul<T> for Complex<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<T: Clone + Num> Div<T> for Complex<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<T: Clone + Num> Zero for Complex<T>
[src]

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

Returns true if self is equal to the additive identity.

impl<T: Clone + Num> One for Complex<T>
[src]

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

impl<T> Display for Complex<T> where T: Display + Num + PartialOrd + Clone
[src]

Formats the value using the given formatter.