#[repr(C)]pub struct Complex128 {
pub re: f64,
pub im: f64,
}Expand description
128-bit complex number with f64 real and imaginary parts
Memory layout: Complex128 is f64 × 2, interleaved format.
This matches the layout expected by CUDA double2.
Fields§
§re: f64Real part
im: f64Imaginary part
Implementations§
Source§impl Complex128
impl Complex128
Sourcepub fn from_polar(r: f64, theta: f64) -> Self
pub fn from_polar(r: f64, theta: f64) -> Self
Create a complex number from polar form: r * e^(iθ)
Sourcepub fn magnitude_squared(self) -> f64
pub fn magnitude_squared(self) -> f64
Squared magnitude: |z|² = re² + im²
More efficient than magnitude() when you only need the squared value.
Trait Implementations§
Source§impl Add for Complex128
impl Add for Complex128
Source§impl AddAssign for Complex128
impl AddAssign for Complex128
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Clone for Complex128
impl Clone for Complex128
Source§fn clone(&self) -> Complex128
fn clone(&self) -> Complex128
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Complex128
impl Debug for Complex128
Source§impl Default for Complex128
impl Default for Complex128
Source§fn default() -> Complex128
fn default() -> Complex128
Returns the “default value” for a type. Read more
Source§impl Display for Complex128
impl Display for Complex128
Source§impl Div for Complex128
impl Div for Complex128
Source§impl Element for Complex128
impl Element for Complex128
Source§impl From<Complex128> for Complex64
impl From<Complex128> for Complex64
Source§fn from(c: Complex128) -> Self
fn from(c: Complex128) -> Self
Converts to this type from the input type.
Source§impl From<Complex64> for Complex128
impl From<Complex64> for Complex128
Source§impl From<f64> for Complex128
impl From<f64> for Complex128
Source§impl Mul for Complex128
impl Mul for Complex128
Source§impl MulAssign for Complex128
impl MulAssign for Complex128
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl Neg for Complex128
impl Neg for Complex128
Source§impl PartialEq for Complex128
impl PartialEq for Complex128
Source§impl PartialOrd for Complex128
impl PartialOrd for Complex128
Source§impl Sub for Complex128
impl Sub for Complex128
Source§impl SubAssign for Complex128
impl SubAssign for Complex128
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Complex128
impl Pod for Complex128
impl StructuralPartialEq for Complex128
Auto Trait Implementations§
impl Freeze for Complex128
impl RefUnwindSafe for Complex128
impl Send for Complex128
impl Sync for Complex128
impl Unpin for Complex128
impl UnsafeUnpin for Complex128
impl UnwindSafe for Complex128
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.