pub struct ComplexSoa<T, V>where
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: VReal parts of four complex numbers (one per lane).
im: VImaginary parts of four complex numbers (one per lane).
Implementations§
Source§impl<T, V> ComplexSoa<T, V>
impl<T, V> ComplexSoa<T, V>
Sourcepub fn load(re_slice: &[T], im_slice: &[T]) -> ComplexSoa<T, V>
pub fn load(re_slice: &[T], im_slice: &[T]) -> ComplexSoa<T, V>
Load four complex numbers from separate re/im slices.
Sourcepub fn from_pairs(p: [(T, T); 4]) -> ComplexSoa<T, V>
pub fn from_pairs(p: [(T, T); 4]) -> ComplexSoa<T, V>
Create from four (re, im) pairs.
Sourcepub fn store(&self, re_slice: &mut [T], im_slice: &mut [T])
pub fn store(&self, re_slice: &mut [T], im_slice: &mut [T])
Store back to separate re/im slices.
Sourcepub fn extract_complex(&self, i: usize) -> (T, T)
pub fn extract_complex(&self, i: usize) -> (T, T)
Extract a single complex value at lane i: returns (re, im).
Sourcepub fn to_complexes(&self) -> [(T, T); 4]
pub fn to_complexes(&self) -> [(T, T); 4]
Extract all four complex values as an array of (re, im) pairs.
Sourcepub fn map_complex<F>(&self, f: F) -> ComplexSoa<T, V>
pub fn map_complex<F>(&self, f: F) -> ComplexSoa<T, V>
Apply a closure to each of the four complex elements.
Sourcepub fn iter_complex(&self) -> impl Iterator<Item = (T, T)>
pub fn iter_complex(&self) -> impl Iterator<Item = (T, T)>
Iterate over the four complex elements as (re, im) pairs.
Sourcepub fn cmul(&self, other: &ComplexSoa<T, V>) -> ComplexSoa<T, V>
pub fn cmul(&self, other: &ComplexSoa<T, V>) -> ComplexSoa<T, V>
Complex multiplication: self * other on four numbers at once.
Sourcepub fn cmul_add(&mut self, a: &ComplexSoa<T, V>, b: &ComplexSoa<T, V>)
pub fn cmul_add(&mut self, a: &ComplexSoa<T, V>, b: &ComplexSoa<T, V>)
Complex multiply-accumulate: self += a * b.
Sourcepub fn conj(&self) -> ComplexSoa<T, V>
pub fn conj(&self) -> ComplexSoa<T, V>
Complex conjugate.
Sourcepub fn all_norm_sqr_lt(&self, threshold_sq: T) -> bool
pub fn all_norm_sqr_lt(&self, threshold_sq: T) -> bool
True if all four norms are below threshold_sq.
Sourcepub fn cadd(&self, other: &ComplexSoa<T, V>) -> ComplexSoa<T, V>
pub fn cadd(&self, other: &ComplexSoa<T, V>) -> ComplexSoa<T, V>
Complex addition: self + other.
Sourcepub fn csub(&self, other: &ComplexSoa<T, V>) -> ComplexSoa<T, V>
pub fn csub(&self, other: &ComplexSoa<T, V>) -> ComplexSoa<T, V>
Complex subtraction: self - other.
Sourcepub fn scale_real(&self, scalar: V) -> ComplexSoa<T, V>
pub fn scale_real(&self, scalar: V) -> ComplexSoa<T, V>
Multiply both re and im by a real scalar vector (per-lane).
Trait Implementations§
Source§impl<T, V> Add for ComplexSoa<T, V>
impl<T, V> Add for ComplexSoa<T, V>
Source§type Output = ComplexSoa<T, V>
type Output = ComplexSoa<T, V>
+ operator.Source§fn add(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
fn add(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
+ operation. Read moreSource§impl<T, V> AddAssign for ComplexSoa<T, V>
impl<T, V> AddAssign for ComplexSoa<T, V>
Source§fn add_assign(&mut self, rhs: ComplexSoa<T, V>)
fn add_assign(&mut self, rhs: ComplexSoa<T, V>)
+= operation. Read moreSource§impl<T, V> Clone for ComplexSoa<T, V>
impl<T, V> Clone for ComplexSoa<T, V>
Source§fn clone(&self) -> ComplexSoa<T, V>
fn clone(&self) -> ComplexSoa<T, V>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<T, V> Copy for ComplexSoa<T, V>
Source§impl<T, V> Debug for ComplexSoa<T, V>
impl<T, V> Debug for ComplexSoa<T, V>
Source§impl<T, V> Div for ComplexSoa<T, V>
Complex division (four at once): (re+im·i)/(rre+rim·i) per lane.
impl<T, V> 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>
type Output = ComplexSoa<T, V>
/ operator.Source§fn div(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
fn div(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
/ operation. Read moreSource§impl<T, V> DivAssign for ComplexSoa<T, V>
impl<T, V> DivAssign for ComplexSoa<T, V>
Source§fn div_assign(&mut self, rhs: ComplexSoa<T, V>)
fn div_assign(&mut self, rhs: ComplexSoa<T, V>)
/= operation. Read moreSource§impl<T, V> Mul for ComplexSoa<T, V>
impl<T, V> Mul for ComplexSoa<T, V>
Source§type Output = ComplexSoa<T, V>
type Output = ComplexSoa<T, V>
* operator.Source§fn mul(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
fn mul(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
* operation. Read moreSource§impl<T, V> Mul<V> for ComplexSoa<T, V>
csoa * sv — scale all four complex numbers by a real vector (per‑lane).
impl<T, V> 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>
type Output = ComplexSoa<T, V>
* operator.Source§fn mul(self, rhs: V) -> ComplexSoa<T, V>
fn mul(self, rhs: V) -> ComplexSoa<T, V>
* operation. Read moreSource§impl<T, V> MulAssign for ComplexSoa<T, V>
impl<T, V> MulAssign for ComplexSoa<T, V>
Source§fn mul_assign(&mut self, rhs: ComplexSoa<T, V>)
fn mul_assign(&mut self, rhs: ComplexSoa<T, V>)
*= operation. Read moreSource§impl<T, V> Neg for ComplexSoa<T, V>
impl<T, V> Neg for ComplexSoa<T, V>
Source§type Output = ComplexSoa<T, V>
type Output = ComplexSoa<T, V>
- operator.Source§fn neg(self) -> ComplexSoa<T, V>
fn neg(self) -> ComplexSoa<T, V>
- operation. Read moreSource§impl<T, V> PartialEq for ComplexSoa<T, V>
impl<T, V> PartialEq for ComplexSoa<T, V>
impl<T, V> StructuralPartialEq for ComplexSoa<T, V>
Source§impl<T, V> Sub for ComplexSoa<T, V>
impl<T, V> Sub for ComplexSoa<T, V>
Source§type Output = ComplexSoa<T, V>
type Output = ComplexSoa<T, V>
- operator.Source§fn sub(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
fn sub(self, rhs: ComplexSoa<T, V>) -> ComplexSoa<T, V>
- operation. Read moreSource§impl<T, V> SubAssign for ComplexSoa<T, V>
impl<T, V> SubAssign for ComplexSoa<T, V>
Source§fn sub_assign(&mut self, rhs: ComplexSoa<T, V>)
fn sub_assign(&mut self, rhs: ComplexSoa<T, V>)
-= operation. Read more