Complex

Struct Complex 

Source
pub struct Complex<T: Float> { /* private fields */ }
Expand description

Struct representing a complex number

Implementations§

Source§

impl<T: Float> Complex<T>

Source

pub fn new(real: T, imag: T) -> Self

Creates a new Complex.

Source

pub fn i() -> Self

Returns the imaginary number i

Source

pub fn real(self) -> T

Returns the real part of this Complex.

Source

pub fn imag(self) -> T

Returns the imaginary part of this Complex.

Source

pub fn conj(self) -> Self

Returns the conjugate of this Complex.

Source

pub fn square_abs(self) -> T

Returns the square of the absolute value of this Complex.

Source

pub fn abs(self) -> T

Returns the absolute value of this Complex.

Source

pub fn arg(self) -> T

Returns the arg on the interval (-PI, PI] of this Complex.

Source

pub fn sqrt(self) -> Self

Returns the square root of this Complex.

Source

pub fn inv(self) -> Self

Returns the multiplicative inverse of this Complex.

Source

pub fn powi(self, exponent: i64) -> Self

Returns this Complex raised to a power using repeated multiplication.

Source

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

Returns this Complex raised to a power using De Moivre’s formula.

Source

pub fn powc(self, exponent: Self) -> Self

Returns this Complex raised to a complex power.

Source

pub fn exp(self) -> Self

Returns e raised to the power of this Complex.

Source

pub fn expf(self, base: T) -> Self

Returns base raised to the power of this Complex.

Source

pub fn ln_abs(self) -> T

Returns the natural logarithm of the absolute value of this Complex.

Source

pub fn ln(self) -> Self

Returns the natural logarithm of this Complex.

Source

pub fn log(self) -> Self

Returns the logarithm base 10 of this Complex.

Source

pub fn logn(self, base: T) -> Self

Returns the logarithm base n of this Complex.

Source§

impl<T: Float + Debug> Complex<T>

Source

pub fn sin(self) -> Self

Returns the sine of this Complex.

Source

pub fn cos(self) -> Self

Returns the cosine of this Complex.

Source

pub fn tan(self) -> Self

Returns the tangent of this Complex.

Source

pub fn cot(self) -> Self

Returns the cotangent of this Complex.

Source

pub fn sec(self) -> Self

Returns the secant of this Complex.

Source

pub fn csc(self) -> Self

Returns the cosecant of this Complex.

Source

pub fn arcsin(self) -> Self

Returns the arcsine of this Complex.

Source

pub fn arccos(self) -> Self

Returns the arccosine of this Complex.

Source

pub fn arctan(self) -> Self

Returns the arctangent of this Complex.

Source

pub fn arccot(self) -> Self

Returns the arccotangent of this Complex.

Source

pub fn arcsec(self) -> Self

Returns the arcsecant of this Complex.

Source

pub fn arccsc(self) -> Self

Source

pub fn sinh(self) -> Self

Returns the hyperbolic sine of this Complex.

Source

pub fn cosh(self) -> Self

Returns the hyperbolic cosine of this Complex.

Source

pub fn tanh(self) -> Self

Returns the hyperbolic tangent of this Complex.

Source

pub fn coth(self) -> Self

Returns the hyperbolic cotangent of this Complex.

Source

pub fn sech(self) -> Self

Returns the hyperbolic secant of this Complex.

Source

pub fn csch(self) -> Self

Returns the hyperbolic cosecant of this Complex.

Source

pub fn arcsinh(self) -> Self

Returns the hyperbolic arcsine of this Complex.

Source

pub fn arccosh(self) -> Self

Returns the hyperbolic arccosine of this Complex.

Source

pub fn arctanh(self) -> Self

Returns the hyperbolic arctangent of this Complex.

Source

pub fn arccoth(self) -> Self

Returns the hyperbolic arccotangent of this Complex.

Source

pub fn arcsech(self) -> Self

Returns the hyperbolic arcsecant of this Complex.

Source

pub fn arccsch(self) -> Self

Returns the hyperbolic arccosecant of this Complex.

Trait Implementations§

Source§

impl Add<Complex<f32>> for f32

f32 + Complex

Source§

type Output = Complex<f32>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Complex<f64>> for f64

f64 + Complex

Source§

type Output = Complex<f64>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Float> Add<T> for Complex<T>

Complex + T

Source§

type Output = Complex<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Float> Add for Complex<T>

Complex + Complex

Source§

type Output = Complex<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: Float> AddAssign<T> for Complex<T>

Complex += T

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl<T: Float> AddAssign for Complex<T>

Complex += Complex

Source§

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

Performs the += operation. Read more
Source§

impl<T: Clone + Float> Clone for Complex<T>

Source§

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

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + Float> Debug for Complex<T>

Source§

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

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

impl<T: Float + Display> Display for Complex<T>

Source§

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

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

impl Div<Complex<f32>> for f32

f32 / Complex

Source§

type Output = Complex<f32>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Complex<f64>> for f64

f64 / Complex

Source§

type Output = Complex<f64>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T: Float> Div<T> for Complex<T>

Complex / T

Source§

type Output = Complex<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T: Float> Div for Complex<T>

Complex / Complex

Source§

type Output = Complex<T>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<T: Float> DivAssign<T> for Complex<T>

Complex /= T

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T: Float> DivAssign for Complex<T>

Complex /= Complex

Source§

fn div_assign(&mut self, rhs: Complex<T>)

Performs the /= operation. Read more
Source§

impl Mul<Complex<f32>> for f32

Complex * f32

Source§

type Output = Complex<f32>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Complex<f64>> for f64

Complex * f64

Source§

type Output = Complex<f64>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Float> Mul<T> for Complex<T>

Complex * T

Source§

type Output = Complex<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Float> Mul for Complex<T>

Complex * Complex

Source§

type Output = Complex<T>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Float> MulAssign<T> for Complex<T>

Complex *= T

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T: Float> MulAssign for Complex<T>

Complex *= Complex

Source§

fn mul_assign(&mut self, rhs: Complex<T>)

Performs the *= operation. Read more
Source§

impl<T: Float> Neg for Complex<T>

-Complex

Source§

type Output = Complex<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Complex<T>

Performs the unary - operation. Read more
Source§

impl<T: PartialEq + Float> PartialEq for Complex<T>

Source§

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

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

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 Sub<Complex<f32>> for f32

f32 - Complex

Source§

type Output = Complex<f32>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Complex<f64>> for f64

f64 - Complex

Source§

type Output = Complex<f64>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Float> Sub<T> for Complex<T>

Complex - T

Source§

type Output = Complex<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Float> Sub for Complex<T>

Complex - Complex

Source§

type Output = Complex<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: Float> SubAssign<T> for Complex<T>

Complex -= T

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<T: Float> SubAssign for Complex<T>

Complex -= Complex

Source§

fn sub_assign(&mut self, rhs: Complex<T>)

Performs the -= operation. Read more
Source§

impl<T: Copy + Float> Copy for Complex<T>

Source§

impl<T: Float> StructuralPartialEq for Complex<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.