pub struct Complex {
pub re: f64,
pub im: f64,
}Expand description
Complex number with full arithmetic.
Fields§
§re: f64§im: f64Implementations§
Source§impl Complex
impl Complex
pub fn new(re: f64, im: f64) -> Self
pub fn zero() -> Self
pub fn one() -> Self
pub fn i() -> Self
pub fn norm_sq(&self) -> f64
pub fn norm(&self) -> f64
pub fn conj(&self) -> Self
pub fn exp(self) -> Self
pub fn from_polar(r: f64, theta: f64) -> Self
pub fn arg(&self) -> f64
pub fn scale(self, s: f64) -> Self
Trait Implementations§
Source§impl AddAssign for Complex
impl AddAssign for Complex
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl MulAssign for Complex
impl MulAssign for Complex
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl SubAssign for Complex
impl SubAssign for Complex
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Complex
impl StructuralPartialEq for Complex
Auto Trait Implementations§
impl Freeze for Complex
impl RefUnwindSafe for Complex
impl Send for Complex
impl Sync for Complex
impl Unpin for Complex
impl UnsafeUnpin for Complex
impl UnwindSafe for Complex
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