Skip to main content

ComplexSoa

Struct ComplexSoa 

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

Four complex numbers, separate re/im arrays. For SIMD‑heavy operations.

Fields§

§re: V

Real parts of four complex numbers (one per lane).

§im: V

Imaginary parts of four complex numbers (one per lane).

Implementations§

Source§

impl<T: Transcendental, V: Vector<T, 4> + VectorMask<T, 4>> ComplexSoa<T, V>

Source

pub fn load(re_slice: &[T], im_slice: &[T]) -> Self

Load four complex numbers from separate re/im slices.

Source

pub fn from_pairs(p: [(T, T); 4]) -> Self

Create from four (re, im) pairs.

Source

pub fn store(&self, re_slice: &mut [T], im_slice: &mut [T])

Store back to separate re/im slices.

Source

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

Extract a single complex value at lane i: returns (re, im).

Source

pub fn to_complexes(&self) -> [(T, T); 4]

Extract all four complex values as an array of (re, im) pairs.

Source

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

Apply a closure to each of the four complex elements.

Source

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

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

Source

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

Complex multiplication: self * other on four numbers at once.

Source

pub fn cmul_add(&mut self, a: &Self, b: &Self)

Complex multiply-accumulate: self += a * b.

Source

pub fn conj(&self) -> Self

Complex conjugate.

Source

pub fn norm_sqr(&self) -> V

Squared magnitude (re² + im²) per lane.

Source

pub fn all_norm_sqr_lt(&self, threshold_sq: T) -> bool

True if all four norms are below threshold_sq.

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 scale_real(&self, scalar: V) -> Self

Multiply both re and im by a real scalar vector (per-lane).

Trait Implementations§

Source§

impl<T: Transcendental, V: Vector<T, 4> + VectorMask<T, 4>> Add for ComplexSoa<T, V>

Source§

type Output = ComplexSoa<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> + VectorMask<T, 4>> AddAssign for ComplexSoa<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 ComplexSoa<T, V>

Source§

fn clone(&self) -> ComplexSoa<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 ComplexSoa<T, V>

Source§

impl<T: Debug + Transcendental, V: Debug + Vector<T, 4>> Debug for ComplexSoa<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> + VectorMask<T, 4>> Div for ComplexSoa<T, V>

Complex division (four at once): (re+im·i)/(rre+rim·i) per lane.

denom = rre² + rim², then re_out = (re·rre + im·rim)/denom, im_out = (im·rre − re·rim)/denom.

Source§

type Output = ComplexSoa<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> + VectorMask<T, 4>> DivAssign for ComplexSoa<T, V>

Source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4> + VectorMask<T, 4>> Mul for ComplexSoa<T, V>

Source§

type Output = ComplexSoa<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> + VectorMask<T, 4>> Mul<V> for ComplexSoa<T, V>

csoa * sv — scale all four complex numbers by a real vector (per‑lane).

Source§

type Output = ComplexSoa<T, V>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4> + VectorMask<T, 4>> MulAssign for ComplexSoa<T, V>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<T: Transcendental, V: Vector<T, 4> + VectorMask<T, 4>> Neg for ComplexSoa<T, V>

Source§

type Output = ComplexSoa<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 ComplexSoa<T, V>

Source§

fn eq(&self, other: &ComplexSoa<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 ComplexSoa<T, V>

Source§

impl<T: Transcendental, V: Vector<T, 4> + VectorMask<T, 4>> Sub for ComplexSoa<T, V>

Source§

type Output = ComplexSoa<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> + VectorMask<T, 4>> SubAssign for ComplexSoa<T, V>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<T, V> UnwindSafe for ComplexSoa<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