Skip to main content

ComplexVector

Struct ComplexVector 

Source
pub struct ComplexVector<T: Transcendental, V: Vector<T, 4>> { /* private fields */ }
Expand description

Two complex numbers: [re0, im0, re1, im1] in one 4‑lane vector.

Implementations§

Source§

impl<T: Transcendental, V: Vector<T, 4>> ComplexVector<T, V>

Source

pub fn from_raw(data: V) -> Self

Wrap a raw Vector<T,4> in [re0, im0, re1, im1] interleaved layout.

Source

pub fn splat_pair(re: T, im: T) -> Self

Duplicate a single (re, im) pair into both lane pairs.

Source

pub fn from_pair(c: (T, T)) -> Self

Create from a single (re, im) pair, duplicated to both lane pairs.

Source

pub fn from_two(c0: (T, T), c1: (T, T)) -> Self

Create from two possibly-different complex pairs. Pairs go to lanes (0,1) and (2,3) respectively.

Source

pub fn inner(&self) -> &V

Return a reference to the raw Vector<T,4>.

Source

pub fn extract(&self, i: usize) -> T

Extract the i-th lane from the underlying vector.

Source

pub fn re0(&self) -> T

Real part of the first complex element (lane 0).

Source

pub fn im0(&self) -> T

Imaginary part of the first complex element (lane 1).

Source

pub fn conj(&self) -> Self

Complex conjugate.

Source

pub fn cmul(&self, other: &Self) -> Self

Complex multiplication: self * other (element-wise).

Source

pub fn cadd(&self, other: &Self) -> Self

Complex addition: self + other.

Source

pub fn csub(&self, other: &Self) -> Self

Complex subtraction: self - other.

Source

pub fn norm_sqr(&self) -> (T, T)

Magnitude squared per complex element: re² + im² (lane‑pair summed).

Source

pub fn scale_real(&self, scalar: T) -> Self

Multiply both real and imaginary parts by a real scalar.

Source

pub fn to_complex0(&self) -> (T, T)

Extract the first complex value as (re, im).

Source

pub fn to_complex1(&self) -> (T, T)

Extract the second complex value as (re, im).

Source

pub fn map_complex<F>(&self, f: F) -> Self
where F: Fn((T, T)) -> (T, T),

Apply a closure to each of the two complex elements.

Source

pub fn iter_complex(&self) -> impl Iterator<Item = (T, T)>

Iterate over the two complex elements as (re, im) pairs.

Trait Implementations§

Source§

impl<T: Transcendental, V: Vector<T, 4>> Add for ComplexVector<T, V>

Source§

type Output = ComplexVector<T, V>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> AddAssign for ComplexVector<T, V>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: Clone + Transcendental, V: Clone + Vector<T, 4>> Clone for ComplexVector<T, V>

Source§

fn clone(&self) -> ComplexVector<T, V>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Copy + Transcendental, V: Copy + Vector<T, 4>> Copy for ComplexVector<T, V>

Source§

impl<T: Debug + Transcendental, V: Debug + Vector<T, 4>> Debug for ComplexVector<T, V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> Div for ComplexVector<T, V>

Complex division: (a+bi)/(c+di) = (ac+bd)/(c²+d²) + i*(bc-ad)/(c²+d²).

Source§

type Output = ComplexVector<T, V>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> DivAssign for ComplexVector<T, V>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> Mul for ComplexVector<T, V>

Source§

type Output = ComplexVector<T, V>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> Mul<T> for ComplexVector<T, V>

cv * t — scale both complex elements by a real scalar.

Source§

type Output = ComplexVector<T, V>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self

Performs the * operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> MulAssign for ComplexVector<T, V>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> Neg for ComplexVector<T, V>

Source§

type Output = ComplexVector<T, V>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T: PartialEq + Transcendental, V: PartialEq + Vector<T, 4>> PartialEq for ComplexVector<T, V>

Source§

fn eq(&self, other: &ComplexVector<T, V>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq + Transcendental, V: PartialEq + Vector<T, 4>> StructuralPartialEq for ComplexVector<T, V>

Source§

impl<T: Transcendental, V: Vector<T, 4>> Sub for ComplexVector<T, V>

Source§

type Output = ComplexVector<T, V>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4>> SubAssign for ComplexVector<T, V>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<T, V> Freeze for ComplexVector<T, V>
where V: Freeze,

§

impl<T, V> RefUnwindSafe for ComplexVector<T, V>

§

impl<T, V> Send for ComplexVector<T, V>

§

impl<T, V> Sync for ComplexVector<T, V>

§

impl<T, V> Unpin for ComplexVector<T, V>
where V: Unpin, T: Unpin,

§

impl<T, V> UnsafeUnpin for ComplexVector<T, V>
where V: UnsafeUnpin,

§

impl<T, V> UnwindSafe for ComplexVector<T, V>
where V: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert to &dyn std::any::Any
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert to &mut dyn std::any::Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V