pub struct Complex<T> {
pub real: T,
pub imag: T,
}
Expand description
struct for Complex numbers (a+bi)
Fields§
§real: T
real part of complex number
imag: T
imaginary part of complex number
Implementations§
Source§impl<T: Num + Clone> Complex<T>
impl<T: Num + Clone> Complex<T>
Sourcepub fn square_norm(&self) -> T
pub fn square_norm(&self) -> T
Function for find square norm of complex number. Formula: a² + b²
Sourcepub fn square(&self) -> Self
pub fn square(&self) -> Self
Function to complute square (power of 2) of complex number Formula: (a+bi)² = a² + 2abi - b²
pub fn scale(&self, scallar: T) -> Self
pub fn unscale(&self, scallar: T) -> Self
pub fn inv(&self) -> Self
pub fn conj(&self) -> Self
Sourcepub fn gausian_integer(&self, other: Complex<T>) -> Complex<T>
pub fn gausian_integer(&self, other: Complex<T>) -> Complex<T>
Computes gausian integer for complex number
Source§impl<T: Float> Complex<T>
impl<T: Float> Complex<T>
pub fn sin(&self) -> Self
pub fn cos(&self) -> Self
pub fn tan(&self) -> Self
pub fn asin(&self) -> Self
pub fn acos(&self) -> Self
pub fn atan(&self) -> Self
pub fn sinh(&self) -> Self
pub fn cosh(&self) -> Self
pub fn tanh(&self) -> Self
pub fn asinh(self) -> Self
pub fn acosh(self) -> Self
pub fn atanh(self) -> Self
pub fn to_polar(&self) -> (T, T)
pub fn from_polar(radius: T, theta: T) -> Self
pub fn powc(&self, power: Complex<T>) -> Self
pub fn powi(&self, power: i32) -> Self
pub fn powf(&self, power: T) -> Self
pub fn exp(&self) -> Self
pub fn expf(&self, base: T) -> Self
pub fn ln(&self) -> Self
pub fn log(&self, base: T) -> Self
pub fn sqrt(&self) -> Self
pub fn l1_norm(&self) -> T
pub fn norm(&self) -> T
pub fn arg(&self) -> T
Trait Implementations§
Source§impl<T: NumAssign> AddAssign<T> for Complex<T>
impl<T: NumAssign> AddAssign<T> for Complex<T>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+=
operation. Read moreSource§impl<T: NumAssign> AddAssign for Complex<T>
impl<T: NumAssign> AddAssign for Complex<T>
Source§fn add_assign(&mut self, rhs: Complex<T>)
fn add_assign(&mut self, rhs: Complex<T>)
Performs the
+=
operation. Read moreSource§impl<T, U> AsPrimitive<U> for Complex<T>where
T: AsPrimitive<U>,
U: 'static + Copy,
impl<T, U> AsPrimitive<U> for Complex<T>where
T: AsPrimitive<U>,
U: 'static + Copy,
Source§impl<T: NumAssign + Clone> DivAssign<T> for Complex<T>
impl<T: NumAssign + Clone> DivAssign<T> for Complex<T>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/=
operation. Read moreSource§impl<T: Num + Clone> DivAssign for Complex<T>
impl<T: Num + Clone> DivAssign for Complex<T>
Source§fn div_assign(&mut self, rhs: Complex<T>)
fn div_assign(&mut self, rhs: Complex<T>)
Performs the
/=
operation. Read moreSource§impl<T: FromPrimitive + Num> FromPrimitive for Complex<T>
impl<T: FromPrimitive + Num> FromPrimitive for Complex<T>
Source§fn from_u8(n: u8) -> Option<Complex<T>>
fn from_u8(n: u8) -> Option<Complex<T>>
Converts an
u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_u16(n: u16) -> Option<Complex<T>>
fn from_u16(n: u16) -> Option<Complex<T>>
Converts an
u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_u32(n: u32) -> Option<Complex<T>>
fn from_u32(n: u32) -> Option<Complex<T>>
Converts an
u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_u64(n: u64) -> Option<Complex<T>>
fn from_u64(n: u64) -> Option<Complex<T>>
Converts an
u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_u128(n: u128) -> Option<Complex<T>>
fn from_u128(n: u128) -> Option<Complex<T>>
Converts an
u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moreSource§fn from_usize(n: usize) -> Option<Complex<T>>
fn from_usize(n: usize) -> Option<Complex<T>>
Converts a
usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_i8(n: i8) -> Option<Complex<T>>
fn from_i8(n: i8) -> Option<Complex<T>>
Converts an
i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_i16(n: i16) -> Option<Complex<T>>
fn from_i16(n: i16) -> Option<Complex<T>>
Converts an
i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_i32(n: i32) -> Option<Complex<T>>
fn from_i32(n: i32) -> Option<Complex<T>>
Converts an
i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_i64(n: i64) -> Option<Complex<T>>
fn from_i64(n: i64) -> Option<Complex<T>>
Converts an
i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§fn from_i128(n: i128) -> Option<Complex<T>>
fn from_i128(n: i128) -> Option<Complex<T>>
Converts an
i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read moreSource§fn from_isize(n: isize) -> Option<Complex<T>>
fn from_isize(n: isize) -> Option<Complex<T>>
Converts an
isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned.Source§impl<T: NumAssign + Clone> MulAssign<T> for Complex<T>
impl<T: NumAssign + Clone> MulAssign<T> for Complex<T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read moreSource§impl<T: Num + Clone> MulAssign for Complex<T>
impl<T: Num + Clone> MulAssign for Complex<T>
Source§fn mul_assign(&mut self, rhs: Complex<T>)
fn mul_assign(&mut self, rhs: Complex<T>)
Performs the
*=
operation. Read moreSource§impl<T: Ord> Ord for Complex<T>
impl<T: Ord> Ord for Complex<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Complex<T>
impl<T: PartialOrd> PartialOrd for Complex<T>
Source§impl<T: NumAssign + Clone> RemAssign<T> for Complex<T>
impl<T: NumAssign + Clone> RemAssign<T> for Complex<T>
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
Performs the
%=
operation. Read moreSource§impl<T: NumAssign + Clone> RemAssign for Complex<T>
impl<T: NumAssign + Clone> RemAssign for Complex<T>
Source§fn rem_assign(&mut self, rhs: Complex<T>)
fn rem_assign(&mut self, rhs: Complex<T>)
Performs the
%=
operation. Read moreSource§impl<T: NumAssign> SubAssign<T> for Complex<T>
impl<T: NumAssign> SubAssign<T> for Complex<T>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
Performs the
-=
operation. Read moreSource§impl<T: NumAssign> SubAssign for Complex<T>
impl<T: NumAssign> SubAssign for Complex<T>
Source§fn sub_assign(&mut self, rhs: Complex<T>)
fn sub_assign(&mut self, rhs: Complex<T>)
Performs the
-=
operation. Read moreSource§impl<T: ToPrimitive + Num> ToPrimitive for Complex<T>
impl<T: ToPrimitive + Num> ToPrimitive for Complex<T>
Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
Converts the value of
self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
Converts the value of
self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
Converts the value of
self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
Converts the value of
self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned.Source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
Converts the value of
self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read moreSource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
Converts the value of
self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
Converts the value of
self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
Converts the value of
self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
Converts the value of
self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
Converts the value of
self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned.Source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
Converts the value of
self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read moreSource§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
Converts the value of
self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned.impl<T: Copy> Copy for Complex<T>
impl<T: Eq> Eq for Complex<T>
impl<T> 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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more