Complex

Struct Complex 

Source
pub struct Complex {
    pub val: Complex,
}

Fields§

§val: Complex

Implementations§

Source§

impl Complex

Source

pub fn with_val<P, T>(prec: P, val: T) -> Self
where Complex: Assign<T>, P: Prec,

Source§

impl Complex

Source

pub fn real(&self) -> Float

Returns the real part

Source

pub fn imag(&self) -> Float

Returns the imaginary part

Trait Implementations§

Source§

impl<'a> Add<&'a Complex> for Complex

Source§

type Output = Complex

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a, B> Add<B> for &'a Complex
where Complex: Add<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<B> Add<B> for Complex
where Complex: Add<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> Add<Complex> for &'a Complex

Source§

type Output = Complex

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> Add for &'a Complex

Source§

type Output = Complex

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'a Complex) -> Self::Output

Performs the + operation. Read more
Source§

impl Add for Complex

Source§

type Output = Complex

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<'a> AddAssign<&'a Complex> for Complex

Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl<B> AddAssign<B> for Complex
where Complex: AddAssign<B>,

Source§

fn add_assign(&mut self, rhs: B)

Performs the += operation. Read more
Source§

impl AddAssign for Complex

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl CheckedAdd for Complex

Source§

fn checked_add(&self, v: &Self) -> Option<Self>

Adds two numbers, checking for overflow. If overflow happens, None is returned.
Source§

impl CheckedDiv for Complex

Source§

fn checked_div(&self, v: &Self) -> Option<Self>

Divides two numbers, checking for underflow, overflow and division by zero. If any of that happens, None is returned.
Source§

impl CheckedMul for Complex

Source§

fn checked_mul(&self, v: &Self) -> Option<Self>

Multiplies two numbers, checking for underflow or overflow. If underflow or overflow happens, None is returned.
Source§

impl CheckedNeg for Complex

Source§

fn checked_neg(&self) -> Option<Self>

Negates a number, returning None for results that can’t be represented, like signed MIN values that can’t be positive, or non-zero unsigned values that can’t be negative. Read more
Source§

impl CheckedSub for Complex

Source§

fn checked_sub(&self, v: &Self) -> Option<Self>

Subtracts two numbers, checking for underflow. If underflow happens, None is returned.
Source§

impl Clone for Complex

Source§

fn clone(&self) -> Complex

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 ComplexSubset for Complex

Source§

type Real = Float

Source§

type Natural = Integer

Source§

type Integer = Integer

Source§

fn as_real(self) -> Self::Real

Converts self to a real number, discarding any imaginary component, if complex.
Source§

fn as_natural(self) -> Self::Natural

Converts self to a natural number, truncating when necessary.
Source§

fn as_integer(self) -> Self::Integer

Converts self to an integer, truncating when necessary.
Source§

fn floor(self) -> Self

Rounds the real and imaginary components of self to the closest integer downward
Source§

fn ceil(self) -> Self

Rounds the real and imaginary components of self to the closest integer upward
Source§

fn round(self) -> Self

Rounds the real and imaginary components of self to the closest integer
Source§

fn trunc(self) -> Self

Rounds the real and imaginary components of self by removing the factional parts
Source§

fn fract(self) -> Self

Removes the integral parts of the real and imaginary components of self
Source§

fn im(self) -> Self

Sets the real component of self to 0
Source§

fn re(self) -> Self

Sets the imaginary component of self to 0
Source§

fn conj(self) -> Self

The complex conjugate of self
Source§

fn modulus_sqrd(self) -> Self

The square of the complex absolute value of self Read more
Source§

fn modulus(self) -> Self::Real

The complex absolute value of self Read more
Source§

impl Debug for Complex

Source§

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

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

impl Display for Complex

Source§

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

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

impl<'a> Div<&'a Complex> for Complex

Source§

type Output = Complex

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a, B> Div<B> for &'a Complex
where Complex: Div<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<B> Div<B> for Complex
where Complex: Div<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a> Div<Complex> for &'a Complex

Source§

type Output = Complex

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a> Div for &'a Complex

Source§

type Output = Complex

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &'a Complex) -> Self::Output

Performs the / operation. Read more
Source§

impl Div for Complex

Source§

type Output = Complex

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<'a> DivAssign<&'a Complex> for Complex

Source§

fn div_assign(&mut self, rhs: &Self)

Performs the /= operation. Read more
Source§

impl<B> DivAssign<B> for Complex
where Complex: DivAssign<B>,

Source§

fn div_assign(&mut self, rhs: B)

Performs the /= operation. Read more
Source§

impl DivAssign for Complex

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl Divisibility for Complex

Source§

fn divides(self, rhs: Self) -> bool

Determines if there exists an element x such that self*x = rhs
Source§

fn divide(self, rhs: Self) -> Option<Self>

Finds an element x such that self*x = rhs if such an element exists
Source§

fn unit(&self) -> bool

Determines if this element has a multiplicative inverse
Source§

fn inverse(self) -> Option<Self>

Finds this element’s multiplicative inverse if it exists
Source§

impl Exponential for Complex

Source§

fn exp(self) -> Self

The exponential of this ring element Read more
Source§

fn try_ln(self) -> Option<Self>

An inverse of exp(x) where ln(1) = 0 Read more
Source§

impl<T> From<T> for Complex
where Complex: From<T>,

Source§

fn from(src: T) -> Self

Converts to this type from the input type.
Source§

impl Inv for Complex

Source§

type Output = Complex

The result after applying the operator.
Source§

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Source§

impl<'a> Mul<&'a Complex> for Complex

Source§

type Output = Complex

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a, B> Mul<B> for &'a Complex
where Complex: Mul<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<B> Mul<B> for Complex
where Complex: Mul<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> Mul<Complex> for &'a Complex

Source§

type Output = Complex

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> Mul for &'a Complex

Source§

type Output = Complex

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'a Complex) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul for Complex

Source§

type Output = Complex

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<'a> MulAssign<&'a Complex> for Complex

Source§

fn mul_assign(&mut self, rhs: &Self)

Performs the *= operation. Read more
Source§

impl<B> MulAssign<B> for Complex
where Complex: MulAssign<B>,

Source§

fn mul_assign(&mut self, rhs: B)

Performs the *= operation. Read more
Source§

impl MulAssign for Complex

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl Neg for Complex

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl One for Complex

Source§

fn one() -> Self

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

fn is_one(&self) -> bool

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

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl PartialEq for Complex

Source§

fn eq(&self, other: &Complex) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RealExponential for Complex

Source§

fn try_pow(self, power: Self) -> Option<Self>

This element raised to the given power as defined by x^y = exp(ln(x)*y), if ln(x) exists
Source§

fn try_root(self, index: Self) -> Option<Self>

This element taken to the given root as defined as root(x, y) = x^(1/y), if ln(x) and 1/y exist
Source§

fn try_log(self, base: Self) -> Option<Self>

The inverse of pow(), if it exists
Source§

fn ln(self) -> Self

The natural logarithm of self Read more
Source§

fn log(self, base: Self) -> Self

The logarithm of self over a specific base Read more
Source§

fn pow(self, p: Self) -> Self

The power of self over a specific exponent Read more
Source§

fn root(self, r: Self) -> Self

The root of self over a specific index Read more
Source§

fn exp2(self) -> Self

Raises 2 to the power of self
Source§

fn exp10(self) -> Self

Raises 10 to the power of self
Source§

fn log2(self) -> Self

The logarithm of base 2
Source§

fn log10(self) -> Self

The logarithm of base 10
Source§

fn sqrt(self) -> Self

Source§

fn cbrt(self) -> Self

Source§

fn ln_1p(self) -> Self

The natural logarithm of self plus 1. Read more
Source§

fn exp_m1(self) -> Self

The exponential of self minus 1. Read more
Source§

fn e() -> Self

The exponential of 1. Mirrors ::core::f32::consts::E
Source§

fn ln_2() -> Self

The natural logarithm of 2. Mirrors ::core::f32::consts::LN_2
Source§

fn ln_10() -> Self

The natural logarithm of 10. Mirrors ::core::f32::consts::LN_10
Source§

fn log2_e() -> Self

The logarithm base 2 of e. Mirrors ::core::f32::consts::LOG2_E
Source§

fn log10_e() -> Self

The logarithm base 10 of e. Mirrors ::core::f32::consts::LOG10_E
Source§

fn log2_10() -> Self

The logarithm base 2 of 10. Mirrors ::core::f32::consts::LOG2_10
Source§

fn log10_2() -> Self

The logarithm base 10 of 2. Mirrors ::core::f32::consts::LOG10_2
Source§

fn sqrt_2() -> Self

The square root of 2. Mirrors ::core::f32::consts::SQRT_2
Source§

fn frac_1_sqrt_2() -> Self

One over the square root of 2. Mirrors ::core::f32::consts::FRAC_1_SQRT_2
Source§

impl<'a> Sub<&'a Complex> for Complex

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a, B> Sub<B> for &'a Complex
where Complex: Sub<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<B> Sub<B> for Complex
where Complex: Sub<B, Output = Complex>,

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sub<Complex> for &'a Complex

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> Sub for &'a Complex

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'a Complex) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub for Complex

Source§

type Output = Complex

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<'a> SubAssign<&'a Complex> for Complex

Source§

fn sub_assign(&mut self, rhs: &Self)

Performs the -= operation. Read more
Source§

impl<B> SubAssign<B> for Complex
where Complex: SubAssign<B>,

Source§

fn sub_assign(&mut self, rhs: B)

Performs the -= operation. Read more
Source§

impl SubAssign for Complex

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Trig for Complex

Source§

fn sin(self) -> Self

Finds the Sine of the given value Read more
Source§

fn cos(self) -> Self

Finds the Cosine of the given value Read more
Source§

fn tan(self) -> Self

Finds the Tangent of the given value Read more
Source§

fn sinh(self) -> Self

Finds the Hyperbolic Sine of the given value Read more
Source§

fn cosh(self) -> Self

Finds the Hyperbolic Cosine of the given value Read more
Source§

fn tanh(self) -> Self

Finds the Hyperbolic Tangent of the given value Read more
Source§

fn asin(self) -> Self

A continuous inverse function of Sine such that asin(1) = π/2 and asin(-1) = -π/2 Read more
Source§

fn acos(self) -> Self

A continuous inverse function of Cosine such that acos(1) = 0 and asin(-1) = π Read more
Source§

fn atan(self) -> Self

A continuous inverse function of Tangent such that atan(0) = 0 and atan(1) = π/4
Source§

fn asinh(self) -> Self

A continuous inverse function of Hyperbolic Sine such that asinh(0)=0 Read more
Source§

fn acosh(self) -> Self

A continuous inverse function of Hyperbolic Cosine such that acosh(0)=1 Read more
Source§

fn atanh(self) -> Self

A continuous inverse function of Hyperbolic Tangent such that atanh(0)=0 Read more
Source§

fn try_asin(self) -> Option<Self>

A continuous inverse function of Sine such that asin(1) = π/2 and asin(-1) = -π/2 Read more
Source§

fn try_acos(self) -> Option<Self>

A continuous inverse function of Cosine such that acos(1) = 0 and asin(-1) = π Read more
Source§

fn try_asinh(self) -> Option<Self>

A continuous inverse function of Hyperbolic Sine such that asinh(0)=0 Read more
Source§

fn try_acosh(self) -> Option<Self>

A continuous inverse function of Hyperbolic Cosine such that acosh(0)=1 Read more
Source§

fn try_atanh(self) -> Option<Self>

A continuous inverse function of Hyperbolic Tangent such that atanh(0)=0 Read more
Source§

fn atan2(_y: Self, _x: Self) -> Self

A continuous function of two variables where tan(atan2(y,x)) = y/x for y!=0 and atan2(0,1) = 0 Read more
Source§

fn pi() -> Self

The classic cicle constant Read more
Source§

fn sin_cos(self) -> (Self, Self)

Finds both the Sine and Cosine as a tuple Read more
Source§

fn frac_2_pi() -> Self

2/π. Mirrors FRAC_2_PI
Source§

fn frac_pi_2() -> Self

π/2. Mirrors FRAC_PI_2
Source§

fn frac_pi_3() -> Self

π/3. Mirrors FRAC_PI_3
Source§

fn frac_pi_4() -> Self

π/4. Mirrors FRAC_PI_4
Source§

fn frac_pi_6() -> Self

π/6. Mirrors FRAC_PI_6
Source§

fn frac_pi_8() -> Self

π/8. Mirrors FRAC_PI_8
Source§

fn pythag_const() -> Self

The length of the hypotenuse of a unit right-triangle. Mirrors SQRT_2
Source§

fn pythag_const_inv() -> Self

The sine of π/4. Mirrors FRAC_1_SQRT_2
Source§

fn to_degrees(self) -> Self

Source§

fn to_radians(self) -> Self

Source§

impl Zero for Complex

Source§

fn zero() -> Self

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

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl AddAssociative for Complex

Source§

impl AddCommutative for Complex

Source§

impl Distributive for Complex

Source§

impl MulAssociative for Complex

Source§

impl MulCommutative for Complex

Source§

impl NoZeroDivisors for Complex

Source§

impl StructuralPartialEq for Complex

Auto Trait Implementations§

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

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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<G> MulN for G
where G: AddSemigroup + Zero,

Source§

fn mul_n<N>(self, n: N) -> Self
where N: Natural,

Source§

impl<G> MulZ for G
where G: AddMonoid + Negatable,

Source§

fn mul_z<N>(self, n: N) -> Self
where N: IntegerSubset,

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<G> PowN for G
where G: MulSemigroup + One,

Source§

fn pow_n<N>(self, n: N) -> Self
where N: Natural,

Source§

impl<G> PowZ for G
where G: MulMonoid + Invertable,

Source§

fn pow_z<Z>(self, n: Z) -> Self
where Z: IntegerSubset,

Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.