Struct Complex
pub struct Complex<T> {
pub re: T,
pub im: T,
}Expand description
A complex number stored in rectangular form.
Fields§
§re: TThe real component.
im: TThe imaginary component.
Implementations§
§impl<T> Complex<T>where
T: Default,
impl<T> Complex<T>where
T: Default,
pub fn from_imaginary(im: T) -> Complex<T>
pub fn from_imaginary(im: T) -> Complex<T>
Creates an imaginary-only complex value.
§impl<T> Complex<T>
impl<T> Complex<T>
pub fn magnitude_squared(&self) -> T
pub fn magnitude_squared(&self) -> T
Returns the squared magnitude, re^2 + im^2.
§impl Complex<f32>
impl Complex<f32>
pub fn from_polar(magnitude: f32, argument: f32) -> Complex<f32>
pub fn from_polar(magnitude: f32, argument: f32) -> Complex<f32>
Builds a complex value from polar coordinates.
Trait Implementations§
impl<T> Copy for Complex<T>where
T: Copy,
impl<T> Eq for Complex<T>where
T: Eq,
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> UnsafeUnpin for Complex<T>where
T: UnsafeUnpin,
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