#[repr(C)]pub struct Complex {
pub re: f32,
pub im: f32,
}Expand description
Complex number z = re + i·im.
Used as the base type for density matrices, Hamiltonians, and interference kernels in the quantum simulation layer. Arithmetic follows standard complex field rules.
Fields§
§re: f32§im: f32Implementations§
Source§impl Complex
impl Complex
pub const ZERO: Complex
pub const ONE: Complex
pub const I: Complex
pub fn new(re: f32, im: f32) -> Complex
pub fn from_real(r: f32) -> Complex
pub fn from_imag(i: f32) -> Complex
Sourcepub fn mul(self, other: Complex) -> Complex
pub fn mul(self, other: Complex) -> Complex
Complex multiplication: (a+bi)(c+di) = (ac-bd) + (ad+bc)i
pub fn add(self, other: Complex) -> Complex
pub fn sub(self, other: Complex) -> Complex
pub fn scale(self, s: f32) -> Complex
Trait Implementations§
impl Copy for Complex
impl Pod for Complex
Available on crate feature
gpu-compute only.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
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 more