#[repr(C)]pub struct Complex<T> {
pub re: T,
pub im: T,
}Expand description
A complex number in Cartesian form.
§Representation and Foreign Function Interface Compatibility
Complex<T> is memory layout compatible with an array [T; 2].
Note that Complex<F> where F is a floating point type is only memory
layout compatible with C’s complex types, not necessarily calling
convention compatible. This means that for FFI you can only pass
Complex<F> behind a pointer, not as a value.
§Examples
Example of extern function declaration.
use num_complex::Complex;
use std::os::raw::c_int;
extern "C" {
fn zaxpy_(n: *const c_int, alpha: *const Complex<f64>,
x: *const Complex<f64>, incx: *const c_int,
y: *mut Complex<f64>, incy: *const c_int);
}Fields§
§re: TReal portion of the complex number
im: TImaginary portion of the complex number
Implementations§
Source§impl<T> Complex<T>
impl<T> Complex<T>
Source§impl<T> Complex<T>
impl<T> Complex<T>
Sourcepub fn l1_norm(&self) -> T
pub fn l1_norm(&self) -> T
Returns the L1 norm |re| + |im| – the Manhattan distance from the origin.
Source§impl<T> Complex<T>where
T: Float,
impl<T> Complex<T>where
T: Float,
Sourcepub fn cis(phase: T) -> Complex<T>
pub fn cis(phase: T) -> Complex<T>
Create a new Complex with a given phase: exp(i * phase).
See cis (mathematics).
Sourcepub fn to_polar(self) -> (T, T)
pub fn to_polar(self) -> (T, T)
Convert to polar form (r, theta), such that
self = r * exp(i * theta)
Sourcepub fn from_polar(r: T, theta: T) -> Complex<T>
pub fn from_polar(r: T, theta: T) -> Complex<T>
Convert a polar representation into a complex number.
Sourcepub fn exp(self) -> Complex<T>
pub fn exp(self) -> Complex<T>
Computes e^(self), where e is the base of the natural logarithm.
Sourcepub fn ln(self) -> Complex<T>
pub fn ln(self) -> Complex<T>
Computes the principal value of natural logarithm of self.
This function has one branch cut:
(-∞, 0], continuous from above.
The branch satisfies -π ≤ arg(ln(z)) ≤ π.
Sourcepub fn sqrt(self) -> Complex<T>
pub fn sqrt(self) -> Complex<T>
Computes the principal value of the square root of self.
This function has one branch cut:
(-∞, 0), continuous from above.
The branch satisfies -π/2 ≤ arg(sqrt(z)) ≤ π/2.
Sourcepub fn cbrt(self) -> Complex<T>
pub fn cbrt(self) -> Complex<T>
Computes the principal value of the cube root of self.
This function has one branch cut:
(-∞, 0), continuous from above.
The branch satisfies -π/3 ≤ arg(cbrt(z)) ≤ π/3.
Note that this does not match the usual result for the cube root of
negative real numbers. For example, the real cube root of -8 is -2,
but the principal complex cube root of -8 is 1 + i√3.
Sourcepub fn log(self, base: T) -> Complex<T>
pub fn log(self, base: T) -> Complex<T>
Returns the logarithm of self with respect to an arbitrary base.
Sourcepub fn expf(self, base: T) -> Complex<T>
pub fn expf(self, base: T) -> Complex<T>
Raises a floating point number to the complex power self.
Sourcepub fn asin(self) -> Complex<T>
pub fn asin(self) -> Complex<T>
Computes the principal value of the inverse sine of self.
This function has two branch cuts:
(-∞, -1), continuous from above.(1, ∞), continuous from below.
The branch satisfies -π/2 ≤ Re(asin(z)) ≤ π/2.
Sourcepub fn acos(self) -> Complex<T>
pub fn acos(self) -> Complex<T>
Computes the principal value of the inverse cosine of self.
This function has two branch cuts:
(-∞, -1), continuous from above.(1, ∞), continuous from below.
The branch satisfies 0 ≤ Re(acos(z)) ≤ π.
Sourcepub fn atan(self) -> Complex<T>
pub fn atan(self) -> Complex<T>
Computes the principal value of the inverse tangent of self.
This function has two branch cuts:
(-∞i, -i], continuous from the left.[i, ∞i), continuous from the right.
The branch satisfies -π/2 ≤ Re(atan(z)) ≤ π/2.
Sourcepub fn asinh(self) -> Complex<T>
pub fn asinh(self) -> Complex<T>
Computes the principal value of inverse hyperbolic sine of self.
This function has two branch cuts:
(-∞i, -i), continuous from the left.(i, ∞i), continuous from the right.
The branch satisfies -π/2 ≤ Im(asinh(z)) ≤ π/2.
Sourcepub fn acosh(self) -> Complex<T>
pub fn acosh(self) -> Complex<T>
Computes the principal value of inverse hyperbolic cosine of self.
This function has one branch cut:
(-∞, 1), continuous from above.
The branch satisfies -π ≤ Im(acosh(z)) ≤ π and 0 ≤ Re(acosh(z)) < ∞.
Sourcepub fn atanh(self) -> Complex<T>
pub fn atanh(self) -> Complex<T>
Computes the principal value of inverse hyperbolic tangent of self.
This function has two branch cuts:
(-∞, -1], continuous from above.[1, ∞), continuous from below.
The branch satisfies -π/2 ≤ Im(atanh(z)) ≤ π/2.
Sourcepub fn finv(self) -> Complex<T>
pub fn finv(self) -> Complex<T>
Returns 1/self using floating-point operations.
This may be more accurate than the generic self.inv() in cases
where self.norm_sqr() would overflow to ∞ or underflow to 0.
§Examples
use num_complex::Complex64;
let c = Complex64::new(1e300, 1e300);
// The generic `inv()` will overflow.
assert!(!c.inv().is_normal());
// But we can do better for `Float` types.
let inv = c.finv();
assert!(inv.is_normal());
println!("{:e}", inv);
let expected = Complex64::new(5e-301, -5e-301);
assert!((inv - expected).norm() < 1e-315);Sourcepub fn fdiv(self, other: Complex<T>) -> Complex<T>
pub fn fdiv(self, other: Complex<T>) -> Complex<T>
Returns self/other using floating-point operations.
This may be more accurate than the generic Div implementation in cases
where other.norm_sqr() would overflow to ∞ or underflow to 0.
§Examples
use num_complex::Complex64;
let a = Complex64::new(2.0, 3.0);
let b = Complex64::new(1e300, 1e300);
// Generic division will overflow.
assert!(!(a / b).is_normal());
// But we can do better for `Float` types.
let quotient = a.fdiv(b);
assert!(quotient.is_normal());
println!("{:e}", quotient);
let expected = Complex64::new(2.5e-300, 5e-301);
assert!((quotient - expected).norm() < 1e-315);Source§impl<T> Complex<T>where
T: Float + FloatConst,
impl<T> Complex<T>where
T: Float + FloatConst,
Trait Implementations§
Source§impl<T> AddAssign for Complex<T>
impl<T> AddAssign for Complex<T>
Source§fn add_assign(&mut self, other: Complex<T>)
fn add_assign(&mut self, other: Complex<T>)
+= operation. Read moreSource§impl<'a, T> AddAssign<&'a Complex<T>> for Complex<T>
impl<'a, T> AddAssign<&'a Complex<T>> for Complex<T>
Source§fn add_assign(&mut self, other: &Complex<T>)
fn add_assign(&mut self, other: &Complex<T>)
+= operation. Read moreSource§impl<'a, T> AddAssign<&'a T> for Complex<T>
impl<'a, T> AddAssign<&'a T> for Complex<T>
Source§fn add_assign(&mut self, other: &T)
fn add_assign(&mut self, other: &T)
+= operation. Read moreSource§impl<T> AddAssign<T> for Complex<T>
impl<T> AddAssign<T> for Complex<T>
Source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
+= operation. Read moreSource§impl<T, U> AsPrimitive<U> for Complex<T>where
T: AsPrimitive<U>,
U: 'static + Copy,
impl<T, U> AsPrimitive<U> for Complex<T>where
T: AsPrimitive<U>,
U: 'static + Copy,
Source§impl Binary<Complex<f32>> for Equal
impl Binary<Complex<f32>> for Equal
fn one(&self, x: Complex<f32>, y: Complex<f32>) -> bool
fn judged(&self, x: Complex<f32>, y: Complex<f32>) -> (bool, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 2], n: usize, out: &mut [MaybeUninit<bool>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f32>> for NotEqual
impl Binary<Complex<f32>> for NotEqual
fn one(&self, x: Complex<f32>, y: Complex<f32>) -> bool
fn judged(&self, x: Complex<f32>, y: Complex<f32>) -> (bool, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 2], n: usize, out: &mut [MaybeUninit<bool>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f32>> for Residue
impl Binary<Complex<f32>> for Residue
fn one(&self, x: Complex<f32>, y: Complex<f32>) -> Complex<f32>
fn judged(&self, x: Complex<f32>, y: Complex<f32>) -> (Complex<f32>, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 2], n: usize, out: &mut [MaybeUninit<Complex<f32>>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f32>> for Gcd
impl Binary<Complex<f32>> for Gcd
fn one(&self, x: Complex<f32>, y: Complex<f32>) -> Complex<f32>
fn judged(&self, x: Complex<f32>, y: Complex<f32>) -> (Complex<f32>, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 2], n: usize, out: &mut [MaybeUninit<Complex<f32>>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f32>> for Lcm
impl Binary<Complex<f32>> for Lcm
fn one(&self, x: Complex<f32>, y: Complex<f32>) -> Complex<f32>
fn judged(&self, x: Complex<f32>, y: Complex<f32>) -> (Complex<f32>, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 2], n: usize, out: &mut [MaybeUninit<Complex<f32>>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f64>> for Equal
impl Binary<Complex<f64>> for Equal
fn one(&self, x: Complex<f64>, y: Complex<f64>) -> bool
fn judged(&self, x: Complex<f64>, y: Complex<f64>) -> (bool, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 2], n: usize, out: &mut [MaybeUninit<bool>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f64>> for NotEqual
impl Binary<Complex<f64>> for NotEqual
fn one(&self, x: Complex<f64>, y: Complex<f64>) -> bool
fn judged(&self, x: Complex<f64>, y: Complex<f64>) -> (bool, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 2], n: usize, out: &mut [MaybeUninit<bool>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f64>> for Residue
impl Binary<Complex<f64>> for Residue
fn one(&self, x: Complex<f64>, y: Complex<f64>) -> Complex<f64>
fn judged(&self, x: Complex<f64>, y: Complex<f64>) -> (Complex<f64>, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 2], n: usize, out: &mut [MaybeUninit<Complex<f64>>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f64>> for Gcd
impl Binary<Complex<f64>> for Gcd
fn one(&self, x: Complex<f64>, y: Complex<f64>) -> Complex<f64>
fn judged(&self, x: Complex<f64>, y: Complex<f64>) -> (Complex<f64>, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 2], n: usize, out: &mut [MaybeUninit<Complex<f64>>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Binary<Complex<f64>> for Lcm
impl Binary<Complex<f64>> for Lcm
fn one(&self, x: Complex<f64>, y: Complex<f64>) -> Complex<f64>
fn judged(&self, x: Complex<f64>, y: Complex<f64>) -> (Complex<f64>, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 2], n: usize, out: &mut [MaybeUninit<Complex<f64>>], ) -> bool
fn checked(&self, x: T, y: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Cast for Complex<f32>
impl Cast for Complex<f32>
Source§impl Cast for Complex<f64>
impl Cast for Complex<f64>
Source§impl<T> ComplexFloat for Complex<T>where
T: Float + FloatConst,
impl<T> ComplexFloat for Complex<T>where
T: Float + FloatConst,
Source§fn abs(self) -> <Complex<T> as ComplexFloat>::Real
fn abs(self) -> <Complex<T> as ComplexFloat>::Real
Source§fn recip(self) -> Complex<T>
fn recip(self) -> Complex<T>
1/x. See also Complex::finv.Source§fn l1_norm(&self) -> <Complex<T> as ComplexFloat>::Real
fn l1_norm(&self) -> <Complex<T> as ComplexFloat>::Real
|re| + |im| – the Manhattan distance from the origin.Source§fn is_infinite(self) -> bool
fn is_infinite(self) -> bool
true if this value is positive infinity or negative infinity and
false otherwise.Source§fn powc(
self,
exp: Complex<<Complex<T> as ComplexFloat>::Real>,
) -> Complex<<Complex<T> as ComplexFloat>::Real>
fn powc( self, exp: Complex<<Complex<T> as ComplexFloat>::Real>, ) -> Complex<<Complex<T> as ComplexFloat>::Real>
self to a complex power.Source§fn log(self, base: <Complex<T> as ComplexFloat>::Real) -> Complex<T>
fn log(self, base: <Complex<T> as ComplexFloat>::Real) -> Complex<T>
Source§fn powf(self, f: <Complex<T> as ComplexFloat>::Real) -> Complex<T>
fn powf(self, f: <Complex<T> as ComplexFloat>::Real) -> Complex<T>
self to a real power.Source§fn asin(self) -> Complex<T>
fn asin(self) -> Complex<T>
Source§fn acos(self) -> Complex<T>
fn acos(self) -> Complex<T>
impl<T> Copy for Complex<T>where
T: Copy,
Source§impl<T> DivAssign for Complex<T>
impl<T> DivAssign for Complex<T>
Source§fn div_assign(&mut self, other: Complex<T>)
fn div_assign(&mut self, other: Complex<T>)
/= operation. Read moreSource§impl<'a, T> DivAssign<&'a Complex<T>> for Complex<T>
impl<'a, T> DivAssign<&'a Complex<T>> for Complex<T>
Source§fn div_assign(&mut self, other: &Complex<T>)
fn div_assign(&mut self, other: &Complex<T>)
/= operation. Read moreSource§impl<'a, T> DivAssign<&'a T> for Complex<T>
impl<'a, T> DivAssign<&'a T> for Complex<T>
Source§fn div_assign(&mut self, other: &T)
fn div_assign(&mut self, other: &T)
/= operation. Read moreSource§impl<T> DivAssign<T> for Complex<T>
impl<T> DivAssign<T> for Complex<T>
Source§fn div_assign(&mut self, other: T)
fn div_assign(&mut self, other: T)
/= operation. Read moreSource§impl Element for Complex<f32>
impl Element for Complex<f32>
Source§const FILL: Complex<f32>
const FILL: Complex<f32>
Source§fn of_mut(buffer: &mut Buffer) -> Option<&mut [Complex<f32>]>
fn of_mut(buffer: &mut Buffer) -> Option<&mut [Complex<f32>]>
buffer, when they have this type. The allocation and length don’t change.Source§fn vec(buffer: Buffer) -> Option<Vec<Complex<f32>>>
fn vec(buffer: Buffer) -> Option<Vec<Complex<f32>>>
buffer, moved out, when they have this type.Source§fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Complex<f32>>>
fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Complex<f32>>>
buffer as their vector, when they have this type, for a writer that appends or clears them.Source§fn truth(b: bool) -> Complex<f32>
fn truth(b: bool) -> Complex<f32>
b as an item of this type: 1 or 0 for a number, the Boolean itself, or the characters U+0001 and U+0000. A Boolean mask becomes lanes of the items that a kernel such as Choose chooses between. A number converts through an integer, which suits stored Booleans. A comparison’s lane mask turns into 1 or 0 faster by a choice between the two, so Indicator writes its own (tolerant::indicated).Source§impl Element for Complex<f64>
impl Element for Complex<f64>
Source§const FILL: Complex<f64>
const FILL: Complex<f64>
Source§fn of_mut(buffer: &mut Buffer) -> Option<&mut [Complex<f64>]>
fn of_mut(buffer: &mut Buffer) -> Option<&mut [Complex<f64>]>
buffer, when they have this type. The allocation and length don’t change.Source§fn vec(buffer: Buffer) -> Option<Vec<Complex<f64>>>
fn vec(buffer: Buffer) -> Option<Vec<Complex<f64>>>
buffer, moved out, when they have this type.Source§fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Complex<f64>>>
fn vec_mut(buffer: &mut Buffer) -> Option<&mut Vec<Complex<f64>>>
buffer as their vector, when they have this type, for a writer that appends or clears them.Source§fn truth(b: bool) -> Complex<f64>
fn truth(b: bool) -> Complex<f64>
b as an item of this type: 1 or 0 for a number, the Boolean itself, or the characters U+0001 and U+0000. A Boolean mask becomes lanes of the items that a kernel such as Choose chooses between. A number converts through an integer, which suits stored Booleans. A comparison’s lane mask turns into 1 or 0 faster by a choice between the two, so Indicator writes its own (tolerant::indicated).impl<T> Eq for Complex<T>where
T: Eq,
Source§impl Factor for Complex<f32>
impl Factor for Complex<f32>
Source§fn matrix_lu_into(a: &[Complex<f32>], n: usize, work: &mut LuWork<Complex<f32>>)
fn matrix_lu_into(a: &[Complex<f32>], n: usize, work: &mut LuWork<Complex<f32>>)
n×n matrix a, into work’s buffers.Source§fn matrix_lu_solve(
lu: Lu<Complex<f32>, &[Complex<f32>], &[usize]>,
b: &[Complex<f32>],
k: usize,
) -> Vec<Complex<f32>>
fn matrix_lu_solve( lu: Lu<Complex<f32>, &[Complex<f32>], &[usize]>, b: &[Complex<f32>], k: usize, ) -> Vec<Complex<f32>>
a x = b for the matrix that lu factors and the n×k matrix b.Source§fn matrix_lu_inverse_into(
lu: Lu<Complex<f32>, &[Complex<f32>], &[usize]>,
x: &mut Vec<Complex<f32>>,
out: &mut [Complex<f32>],
)
fn matrix_lu_inverse_into( lu: Lu<Complex<f32>, &[Complex<f32>], &[usize]>, x: &mut Vec<Complex<f32>>, out: &mut [Complex<f32>], )
lu factors, written into out, with x as scratch.Source§fn matrix_cholesky(a: &[Complex<f32>], n: usize) -> Option<Vec<Complex<f32>>>
fn matrix_cholesky(a: &[Complex<f32>], n: usize) -> Option<Vec<Complex<f32>>>
n×n matrix a, or None where a isn’t positive definite.Source§fn matrix_qr(
a: &[Complex<f32>],
size: [usize; 2],
complete: bool,
) -> (Vec<Complex<f32>>, Vec<Complex<f32>>)
fn matrix_qr( a: &[Complex<f32>], size: [usize; 2], complete: bool, ) -> (Vec<Complex<f32>>, Vec<Complex<f32>>)
a of size [m, n]: thin, or complete where complete is true.Source§fn matrix_qr_into(
a: &[Complex<f32>],
size: [usize; 2],
complete: bool,
work: &mut QrWork<Complex<f32>>,
q: &mut [Complex<f32>],
r: &mut [Complex<f32>],
)
fn matrix_qr_into( a: &[Complex<f32>], size: [usize; 2], complete: bool, work: &mut QrWork<Complex<f32>>, q: &mut [Complex<f32>], r: &mut [Complex<f32>], )
matrix_qr’s Q and R, written into q and r, with work’s buffers.Source§fn matrix_svd(
a: &[Complex<f32>],
size: [usize; 2],
vectors: bool,
) -> Svd<Complex<f32>>
fn matrix_svd( a: &[Complex<f32>], size: [usize; 2], vectors: bool, ) -> Svd<Complex<f32>>
a of size [m, n], with its singular vectors only where vectors is true.Source§fn matrix_truncated_svd(
a: &[Complex<f32>],
size: [usize; 2],
k: usize,
) -> Svd<Complex<f32>>
fn matrix_truncated_svd( a: &[Complex<f32>], size: [usize; 2], k: usize, ) -> Svd<Complex<f32>>
k singular values and vectors of the matrix a of size [m, n].Source§fn matrix_svd_solve(
svd: Svd<Complex<f32>, &[Complex<f32>], &[<Complex<f32> as Scalar>::Real]>,
b: Option<&[Complex<f32>]>,
k: usize,
) -> Vec<Complex<f32>>
fn matrix_svd_solve( svd: Svd<Complex<f32>, &[Complex<f32>], &[<Complex<f32> as Scalar>::Real]>, b: Option<&[Complex<f32>]>, k: usize, ) -> Vec<Complex<f32>>
a x = b for the matrix that svd factors and the m×k matrix b, or without b its n×m pseudoinverse.Source§fn matrix_lstsq(
a: &[Complex<f32>],
b: &[Complex<f32>],
size: [usize; 2],
k: usize,
) -> (Vec<Complex<f32>>, Vec<<Complex<f32> as Scalar>::Real>)
fn matrix_lstsq( a: &[Complex<f32>], b: &[Complex<f32>], size: [usize; 2], k: usize, ) -> (Vec<Complex<f32>>, Vec<<Complex<f32> as Scalar>::Real>)
a x = b, and a’s singular values, for the matrix a of size [m, n] and the m×k matrix b.Source§impl Factor for Complex<f64>
impl Factor for Complex<f64>
Source§fn matrix_lu_into(a: &[Complex<f64>], n: usize, work: &mut LuWork<Complex<f64>>)
fn matrix_lu_into(a: &[Complex<f64>], n: usize, work: &mut LuWork<Complex<f64>>)
n×n matrix a, into work’s buffers.Source§fn matrix_lu_solve(
lu: Lu<Complex<f64>, &[Complex<f64>], &[usize]>,
b: &[Complex<f64>],
k: usize,
) -> Vec<Complex<f64>>
fn matrix_lu_solve( lu: Lu<Complex<f64>, &[Complex<f64>], &[usize]>, b: &[Complex<f64>], k: usize, ) -> Vec<Complex<f64>>
a x = b for the matrix that lu factors and the n×k matrix b.Source§fn matrix_lu_inverse_into(
lu: Lu<Complex<f64>, &[Complex<f64>], &[usize]>,
x: &mut Vec<Complex<f64>>,
out: &mut [Complex<f64>],
)
fn matrix_lu_inverse_into( lu: Lu<Complex<f64>, &[Complex<f64>], &[usize]>, x: &mut Vec<Complex<f64>>, out: &mut [Complex<f64>], )
lu factors, written into out, with x as scratch.Source§fn matrix_cholesky(a: &[Complex<f64>], n: usize) -> Option<Vec<Complex<f64>>>
fn matrix_cholesky(a: &[Complex<f64>], n: usize) -> Option<Vec<Complex<f64>>>
n×n matrix a, or None where a isn’t positive definite.Source§fn matrix_qr(
a: &[Complex<f64>],
size: [usize; 2],
complete: bool,
) -> (Vec<Complex<f64>>, Vec<Complex<f64>>)
fn matrix_qr( a: &[Complex<f64>], size: [usize; 2], complete: bool, ) -> (Vec<Complex<f64>>, Vec<Complex<f64>>)
a of size [m, n]: thin, or complete where complete is true.Source§fn matrix_qr_into(
a: &[Complex<f64>],
size: [usize; 2],
complete: bool,
work: &mut QrWork<Complex<f64>>,
q: &mut [Complex<f64>],
r: &mut [Complex<f64>],
)
fn matrix_qr_into( a: &[Complex<f64>], size: [usize; 2], complete: bool, work: &mut QrWork<Complex<f64>>, q: &mut [Complex<f64>], r: &mut [Complex<f64>], )
matrix_qr’s Q and R, written into q and r, with work’s buffers.Source§fn matrix_svd(
a: &[Complex<f64>],
size: [usize; 2],
vectors: bool,
) -> Svd<Complex<f64>>
fn matrix_svd( a: &[Complex<f64>], size: [usize; 2], vectors: bool, ) -> Svd<Complex<f64>>
a of size [m, n], with its singular vectors only where vectors is true.Source§fn matrix_truncated_svd(
a: &[Complex<f64>],
size: [usize; 2],
k: usize,
) -> Svd<Complex<f64>>
fn matrix_truncated_svd( a: &[Complex<f64>], size: [usize; 2], k: usize, ) -> Svd<Complex<f64>>
k singular values and vectors of the matrix a of size [m, n].Source§fn matrix_svd_solve(
svd: Svd<Complex<f64>, &[Complex<f64>], &[<Complex<f64> as Scalar>::Real]>,
b: Option<&[Complex<f64>]>,
k: usize,
) -> Vec<Complex<f64>>
fn matrix_svd_solve( svd: Svd<Complex<f64>, &[Complex<f64>], &[<Complex<f64> as Scalar>::Real]>, b: Option<&[Complex<f64>]>, k: usize, ) -> Vec<Complex<f64>>
a x = b for the matrix that svd factors and the m×k matrix b, or without b its n×m pseudoinverse.Source§fn matrix_lstsq(
a: &[Complex<f64>],
b: &[Complex<f64>],
size: [usize; 2],
k: usize,
) -> (Vec<Complex<f64>>, Vec<<Complex<f64> as Scalar>::Real>)
fn matrix_lstsq( a: &[Complex<f64>], b: &[Complex<f64>], size: [usize; 2], k: usize, ) -> (Vec<Complex<f64>>, Vec<<Complex<f64> as Scalar>::Real>)
a x = b, and a’s singular values, for the matrix a of size [m, n] and the m×k matrix b.Source§impl<T> FromPrimitive for Complex<T>where
T: FromPrimitive + Num,
impl<T> FromPrimitive for Complex<T>where
T: FromPrimitive + Num,
Source§fn from_usize(n: usize) -> Option<Complex<T>>
fn from_usize(n: usize) -> Option<Complex<T>>
usize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_isize(n: isize) -> Option<Complex<T>>
fn from_isize(n: isize) -> Option<Complex<T>>
isize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u8(n: u8) -> Option<Complex<T>>
fn from_u8(n: u8) -> Option<Complex<T>>
u8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u16(n: u16) -> Option<Complex<T>>
fn from_u16(n: u16) -> Option<Complex<T>>
u16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u32(n: u32) -> Option<Complex<T>>
fn from_u32(n: u32) -> Option<Complex<T>>
u32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u64(n: u64) -> Option<Complex<T>>
fn from_u64(n: u64) -> Option<Complex<T>>
u64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i8(n: i8) -> Option<Complex<T>>
fn from_i8(n: i8) -> Option<Complex<T>>
i8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i16(n: i16) -> Option<Complex<T>>
fn from_i16(n: i16) -> Option<Complex<T>>
i16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i32(n: i32) -> Option<Complex<T>>
fn from_i32(n: i32) -> Option<Complex<T>>
i32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i64(n: i64) -> Option<Complex<T>>
fn from_i64(n: i64) -> Option<Complex<T>>
i64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u128(n: u128) -> Option<Complex<T>>
fn from_u128(n: u128) -> Option<Complex<T>>
u128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_i128(n: i128) -> Option<Complex<T>>
fn from_i128(n: i128) -> Option<Complex<T>>
i128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§impl Inner<Complex<f32>> for PlusTimes
impl Inner<Complex<f32>> for PlusTimes
Source§fn inner_ops(
&self,
a: &[Complex<f32>],
b: &[Complex<f32>],
_: [Orientation; 2],
_: [usize; 3],
) -> Vec<Complex<f32>>
fn inner_ops( &self, a: &[Complex<f32>], b: &[Complex<f32>], _: [Orientation; 2], _: [usize; 3], ) -> Vec<Complex<f32>>
inner of the matrices that a and b give in the orientations given, with size [m, k, n] for those matrices. A transposed a holds a k×m matrix, row-major, and gives its m×k transpose. This default copies a transposed operand into its orientation. Float and complex PlusTimes read it in place.Source§fn inner_into(
&self,
a: &[Complex<f32>],
b: &[Complex<f32>],
_: [usize; 3],
c: &mut [Complex<f32>],
)
fn inner_into( &self, a: &[Complex<f32>], b: &[Complex<f32>], _: [usize; 3], c: &mut [Complex<f32>], )
m×n inner product of a, an m×k matrix, and b, a k×n matrix, both row-major, written row-major into out, which holds m×n items. size is [m, k, n]. Where k is 0, each result is the identity of f. An integer result that doesn’t fit its type panics, where checked_into gives false.Source§fn inner_mapped_into(
&self,
a: Mapped<'_, Complex<f32>>,
b: Mapped<'_, Complex<f32>>,
orientations: [Orientation; 2],
size: [usize; 3],
out: &mut [Complex<f32>],
)
fn inner_mapped_into( &self, a: Mapped<'_, Complex<f32>>, b: Mapped<'_, Complex<f32>>, orientations: [Orientation; 2], size: [usize; 3], out: &mut [Complex<f32>], )
inner_into of operands whose items come through mappings, as Mapped describes. This default reads each operand whole and copies transposed operands into their orientations. Float and complex PlusTimes read an operand that isn’t held in order one block of its stored rows at a time and multiply each block as it’s read. Only one block of that operand then exists at once.Source§fn inner(&self, a: &[T], b: &[T], size: [usize; 3]) -> Vec<Self::Out>
fn inner(&self, a: &[T], b: &[T], size: [usize; 3]) -> Vec<Self::Out>
inner_into’s results, as a new row-major matrix.Source§impl Inner<Complex<f64>> for PlusTimes
impl Inner<Complex<f64>> for PlusTimes
Source§fn inner_ops(
&self,
a: &[Complex<f64>],
b: &[Complex<f64>],
_: [Orientation; 2],
_: [usize; 3],
) -> Vec<Complex<f64>>
fn inner_ops( &self, a: &[Complex<f64>], b: &[Complex<f64>], _: [Orientation; 2], _: [usize; 3], ) -> Vec<Complex<f64>>
inner of the matrices that a and b give in the orientations given, with size [m, k, n] for those matrices. A transposed a holds a k×m matrix, row-major, and gives its m×k transpose. This default copies a transposed operand into its orientation. Float and complex PlusTimes read it in place.Source§fn inner_into(
&self,
a: &[Complex<f64>],
b: &[Complex<f64>],
_: [usize; 3],
c: &mut [Complex<f64>],
)
fn inner_into( &self, a: &[Complex<f64>], b: &[Complex<f64>], _: [usize; 3], c: &mut [Complex<f64>], )
m×n inner product of a, an m×k matrix, and b, a k×n matrix, both row-major, written row-major into out, which holds m×n items. size is [m, k, n]. Where k is 0, each result is the identity of f. An integer result that doesn’t fit its type panics, where checked_into gives false.Source§fn inner_mapped_into(
&self,
a: Mapped<'_, Complex<f64>>,
b: Mapped<'_, Complex<f64>>,
orientations: [Orientation; 2],
size: [usize; 3],
out: &mut [Complex<f64>],
)
fn inner_mapped_into( &self, a: Mapped<'_, Complex<f64>>, b: Mapped<'_, Complex<f64>>, orientations: [Orientation; 2], size: [usize; 3], out: &mut [Complex<f64>], )
inner_into of operands whose items come through mappings, as Mapped describes. This default reads each operand whole and copies transposed operands into their orientations. Float and complex PlusTimes read an operand that isn’t held in order one block of its stored rows at a time and multiply each block as it’s read. Only one block of that operand then exists at once.Source§fn inner(&self, a: &[T], b: &[T], size: [usize; 3]) -> Vec<Self::Out>
fn inner(&self, a: &[T], b: &[T], size: [usize; 3]) -> Vec<Self::Out>
inner_into’s results, as a new row-major matrix.Source§impl<F> Inverse<Complex<F>> for Sumwhere
F: Native,
impl<F> Inverse<Complex<F>> for Sumwhere
F: Native,
Source§fn inverse(acc: Complex<F>, x: Complex<F>) -> (Complex<F>, bool)
fn inverse(acc: Complex<F>, x: Complex<F>) -> (Complex<F>, bool)
acc with the item x taken away, and whether it fits.Source§fn undo(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
fn undo(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
a with the fold b of the next run taken away, and whether it fits.Source§impl<F> Inverse<Complex<F>> for Productwhere
F: Native,
Product’s inverse on complex numbers, which divides as crate::divide does.
impl<F> Inverse<Complex<F>> for Productwhere
F: Native,
Product’s inverse on complex numbers, which divides as crate::divide does.
Source§fn inverse(acc: Complex<F>, x: Complex<F>) -> (Complex<F>, bool)
fn inverse(acc: Complex<F>, x: Complex<F>) -> (Complex<F>, bool)
acc with the item x taken away, and whether it fits.Source§fn undo(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
fn undo(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
a with the fold b of the next run taken away, and whether it fits.Source§impl Item for Complex<f32>
impl Item for Complex<f32>
Source§fn cells_from<S, C>(
_out: &mut [Self],
_items: &[S],
_conv: &C,
_at: usize,
_step: isize,
_rest: &[Cow<'_, Steps>],
) -> bool
fn cells_from<S, C>( _out: &mut [Self], _items: &[S], _conv: &C, _at: usize, _step: isize, _rest: &[Cow<'_, Steps>], ) -> bool
items into out, each converted by conv: one cell at each start along a stride of step from at, with its items at the offsets that rest reaches. Gives whether a fixed-width loop that converts from S wrote them. Only f64 has such loops, for the sources whose Item::cells_into_f64 has one. Otherwise scatter_walk converts a block at a time.Source§impl Item for Complex<f64>
impl Item for Complex<f64>
Source§fn cells_from<S, C>(
_out: &mut [Self],
_items: &[S],
_conv: &C,
_at: usize,
_step: isize,
_rest: &[Cow<'_, Steps>],
) -> bool
fn cells_from<S, C>( _out: &mut [Self], _items: &[S], _conv: &C, _at: usize, _step: isize, _rest: &[Cow<'_, Steps>], ) -> bool
items into out, each converted by conv: one cell at each start along a stride of step from at, with its items at the offsets that rest reaches. Gives whether a fixed-width loop that converts from S wrote them. Only f64 has such loops, for the sources whose Item::cells_into_f64 has one. Otherwise scatter_walk converts a block at a time.Source§impl KernelItem for Complex<f32>
impl KernelItem for Complex<f32>
Source§impl KernelItem for Complex<f64>
impl KernelItem for Complex<f64>
Source§impl<T> MulAddAssign for Complex<T>
impl<T> MulAddAssign for Complex<T>
Source§fn mul_add_assign(&mut self, other: Complex<T>, add: Complex<T>)
fn mul_add_assign(&mut self, other: Complex<T>, add: Complex<T>)
*self = (*self * a) + bSource§impl<'a, 'b, T> MulAddAssign<&'a Complex<T>, &'b Complex<T>> for Complex<T>
impl<'a, 'b, T> MulAddAssign<&'a Complex<T>, &'b Complex<T>> for Complex<T>
Source§fn mul_add_assign(&mut self, other: &Complex<T>, add: &Complex<T>)
fn mul_add_assign(&mut self, other: &Complex<T>, add: &Complex<T>)
*self = (*self * a) + bSource§impl<T> MulAssign for Complex<T>
impl<T> MulAssign for Complex<T>
Source§fn mul_assign(&mut self, other: Complex<T>)
fn mul_assign(&mut self, other: Complex<T>)
*= operation. Read moreSource§impl<'a, T> MulAssign<&'a Complex<T>> for Complex<T>
impl<'a, T> MulAssign<&'a Complex<T>> for Complex<T>
Source§fn mul_assign(&mut self, other: &Complex<T>)
fn mul_assign(&mut self, other: &Complex<T>)
*= operation. Read moreSource§impl<'a, T> MulAssign<&'a T> for Complex<T>
impl<'a, T> MulAssign<&'a T> for Complex<T>
Source§fn mul_assign(&mut self, other: &T)
fn mul_assign(&mut self, other: &T)
*= operation. Read moreSource§impl<T> MulAssign<T> for Complex<T>
impl<T> MulAssign<T> for Complex<T>
Source§fn mul_assign(&mut self, other: T)
fn mul_assign(&mut self, other: T)
*= operation. Read moreSource§impl<T> Num for Complex<T>
impl<T> Num for Complex<T>
Source§fn from_str_radix(
s: &str,
radix: u32,
) -> Result<Complex<T>, <Complex<T> as Num>::FromStrRadixErr>
fn from_str_radix( s: &str, radix: u32, ) -> Result<Complex<T>, <Complex<T> as Num>::FromStrRadixErr>
Parses a +/- bi; ai +/- b; a; or bi where a and b are of type T
radix must be <= 18; larger radix would include i and j as digits,
which cannot be supported.
The conversion returns an error if 18 <= radix <= 36; it panics if radix > 36.
The elements of T are parsed using Num::from_str_radix too, and errors
(or panics) from that are reflected here as well.
type FromStrRadixErr = ParseComplexError<<T as Num>::FromStrRadixErr>
Source§impl OutputItem for Complex<f32>
impl OutputItem for Complex<f32>
Source§impl OutputItem for Complex<f64>
impl OutputItem for Complex<f64>
Source§impl<'a, 'b, T> Pow<&'b Complex<T>> for &'a Complex<T>where
T: Float,
Available on crate features libm or std only.
impl<'a, 'b, T> Pow<&'b Complex<T>> for &'a Complex<T>where
T: Float,
libm or std only.Source§impl<'b, T> Pow<&'b Complex<T>> for Complex<T>where
T: Float,
Available on crate features libm or std only.
impl<'b, T> Pow<&'b Complex<T>> for Complex<T>where
T: Float,
libm or std only.Source§impl<'a, T> Pow<Complex<T>> for &'a Complex<T>where
T: Float,
Available on crate features libm or std only.
impl<'a, T> Pow<Complex<T>> for &'a Complex<T>where
T: Float,
libm or std only.Source§impl<T> Pow<Complex<T>> for Complex<T>where
T: Float,
Available on crate features libm or std only.
impl<T> Pow<Complex<T>> for Complex<T>where
T: Float,
libm or std only.Source§impl<F> Reduction<Complex<F>> for Sumwhere
F: Native,
Each sum of complex numbers adds their real parts and their imaginary parts, in any order.
impl<F> Reduction<Complex<F>> for Sumwhere
F: Native,
Each sum of complex numbers adds their real parts and their imaginary parts, in any order.
Source§const COMMUTATIVE: bool = true
const COMMUTATIVE: bool = true
Source§type Total = Complex<F>
type Total = Complex<F>
i64 for a sum or product of integers narrower than 64 bits, f32 for a sum or product of f16s, i16 for an XNOR of bytes, the C of SumAs, f64 for Squares, a Scaled product for ScaledProduct, or a total with the parity of its count for Alternated.Source§fn unit() -> Complex<F>
fn unit() -> Complex<F>
Source§fn merge(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
fn merge(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
Source§fn identity() -> Complex<F>
fn identity() -> Complex<F>
step, which leaves every total unchanged. For float sums it’s -0.0, because adding unit(), 0.0, turns a total of -0.0 into 0.0. For every other reduction it’s unit().Source§fn slice(x: &[Complex<F>]) -> (Complex<F>, bool)
fn slice(x: &[Complex<F>]) -> (Complex<F>, bool)
x, which is unit() where x is empty, and whether it fits. The default takes each item in turn by checked.Source§fn scan(
x: &[Complex<F>],
start: Option<Complex<F>>,
out: &mut Vec<Complex<F>>,
) -> bool
fn scan( x: &[Complex<F>], start: Option<Complex<F>>, out: &mut Vec<Complex<F>>, ) -> bool
x to out, the first combining start where it is given, and gives whether every one fits. The default takes each item in turn by checked (checked_steps).Source§fn checked(acc: Self::Total, x: T) -> (Self::Total, bool)
fn checked(acc: Self::Total, x: T) -> (Self::Total, bool)
step, and whether its result fits. An integer sum or product wraps where it doesn’t.Source§fn one(x: T) -> (Self::Total, bool)
fn one(x: T) -> (Self::Total, bool)
x, checked(identity(), x), and whether it fits.Source§fn chain(a: Self::Total, b: Self::Total) -> (Self::Total, bool)
fn chain(a: Self::Total, b: Self::Total) -> (Self::Total, bool)
merge, for a chain of folds whose every step waits for the one before, as van Herk-Gil-Werman’s suffixes and prefixes do. As in merge, a folds the earlier items. Float maximums and minimums override it with Folds::step_max and step_min, which use AArch64’s one-instruction fmaxnm and fminnm. LLVM can’t vectorize those, so they stay out of merge.Source§fn rows(data: &[T], columns: usize, out: &mut [Self::Total]) -> bool
fn rows(data: &[T], columns: usize, out: &mut [Self::Total]) -> bool
data, a matrix with columns items in each row, into the matching item of out, and gives whether every fold fits. The default is fold_rows, which folds each row of 16 items or more by slice. Float sums and products, integer maximums and minimums, and bitwise folds fold rows of 16 to 63 items by checked instead, eight rows side by side (rows_side_by_side). Each of their steps is one instruction, so keeping several rows’ steps in flight costs less than a call of slice for each row. Other reductions keep fold_rows, where slice vectorizes within the row: an integer sum’s step checks for overflow, and a float maximum’s or minimum’s slice runs Folds’ vector kernels. Nobody has timed float maximums side by side since their step became one select on x86.Source§fn short_lanes(
_data: &[T],
_len: usize,
_start: Option<Self::Total>,
_out: &mut Vec<Self::Total>,
) -> Option<bool>where
Self: Sized,
fn short_lanes(
_data: &[T],
_len: usize,
_start: Option<Self::Total>,
_out: &mut Vec<Self::Total>,
) -> Option<bool>where
Self: Sized,
data’s lanes of len consecutive items to out, each lane from start, through a route that runs many short lanes at once, and gives whether every fold fits. A reduction without such a route gives None and appends nothing, as the default does. scan_along then runs the lanes itself. The Boolean reductions run lanes of 1 to 64 items through Logical, 64 items to a word.Source§const SPLIT: usize = 8
const SPLIT: usize = 8
crate::search::ClassNumbers folds each class into four totals by position. Each step of a class’s total waits on the last through memory, so a reduction whose step takes longer gains from the split over more classes.Source§impl<F> Reduction<Complex<F>> for Productwhere
F: Native,
Complex products regroup multiplication through the same running totals as real products.
impl<F> Reduction<Complex<F>> for Productwhere
F: Native,
Complex products regroup multiplication through the same running totals as real products.
Source§const COMMUTATIVE: bool = true
const COMMUTATIVE: bool = true
Source§type Total = Complex<F>
type Total = Complex<F>
i64 for a sum or product of integers narrower than 64 bits, f32 for a sum or product of f16s, i16 for an XNOR of bytes, the C of SumAs, f64 for Squares, a Scaled product for ScaledProduct, or a total with the parity of its count for Alternated.Source§fn unit() -> Complex<F>
fn unit() -> Complex<F>
Source§fn merge(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
fn merge(a: Complex<F>, b: Complex<F>) -> (Complex<F>, bool)
Source§fn slice(x: &[Complex<F>]) -> (Complex<F>, bool)
fn slice(x: &[Complex<F>]) -> (Complex<F>, bool)
x, which is unit() where x is empty, and whether it fits. The default takes each item in turn by checked.Source§fn scan(
x: &[Complex<F>],
start: Option<Complex<F>>,
out: &mut Vec<Complex<F>>,
) -> bool
fn scan( x: &[Complex<F>], start: Option<Complex<F>>, out: &mut Vec<Complex<F>>, ) -> bool
x to out, the first combining start where it is given, and gives whether every one fits. The default takes each item in turn by checked (checked_steps).Source§fn identity() -> Self::Total
fn identity() -> Self::Total
step, which leaves every total unchanged. For float sums it’s -0.0, because adding unit(), 0.0, turns a total of -0.0 into 0.0. For every other reduction it’s unit().Source§fn checked(acc: Self::Total, x: T) -> (Self::Total, bool)
fn checked(acc: Self::Total, x: T) -> (Self::Total, bool)
step, and whether its result fits. An integer sum or product wraps where it doesn’t.Source§fn one(x: T) -> (Self::Total, bool)
fn one(x: T) -> (Self::Total, bool)
x, checked(identity(), x), and whether it fits.Source§fn chain(a: Self::Total, b: Self::Total) -> (Self::Total, bool)
fn chain(a: Self::Total, b: Self::Total) -> (Self::Total, bool)
merge, for a chain of folds whose every step waits for the one before, as van Herk-Gil-Werman’s suffixes and prefixes do. As in merge, a folds the earlier items. Float maximums and minimums override it with Folds::step_max and step_min, which use AArch64’s one-instruction fmaxnm and fminnm. LLVM can’t vectorize those, so they stay out of merge.Source§fn rows(data: &[T], columns: usize, out: &mut [Self::Total]) -> bool
fn rows(data: &[T], columns: usize, out: &mut [Self::Total]) -> bool
data, a matrix with columns items in each row, into the matching item of out, and gives whether every fold fits. The default is fold_rows, which folds each row of 16 items or more by slice. Float sums and products, integer maximums and minimums, and bitwise folds fold rows of 16 to 63 items by checked instead, eight rows side by side (rows_side_by_side). Each of their steps is one instruction, so keeping several rows’ steps in flight costs less than a call of slice for each row. Other reductions keep fold_rows, where slice vectorizes within the row: an integer sum’s step checks for overflow, and a float maximum’s or minimum’s slice runs Folds’ vector kernels. Nobody has timed float maximums side by side since their step became one select on x86.Source§fn short_lanes(
_data: &[T],
_len: usize,
_start: Option<Self::Total>,
_out: &mut Vec<Self::Total>,
) -> Option<bool>where
Self: Sized,
fn short_lanes(
_data: &[T],
_len: usize,
_start: Option<Self::Total>,
_out: &mut Vec<Self::Total>,
) -> Option<bool>where
Self: Sized,
data’s lanes of len consecutive items to out, each lane from start, through a route that runs many short lanes at once, and gives whether every fold fits. A reduction without such a route gives None and appends nothing, as the default does. scan_along then runs the lanes itself. The Boolean reductions run lanes of 1 to 64 items through Logical, 64 items to a word.Source§const SPLIT: usize = 8
const SPLIT: usize = 8
crate::search::ClassNumbers folds each class into four totals by position. Each step of a class’s total waits on the last through memory, so a reduction whose step takes longer gains from the split over more classes.Source§impl<T> RemAssign for Complex<T>
impl<T> RemAssign for Complex<T>
Source§fn rem_assign(&mut self, modulus: Complex<T>)
fn rem_assign(&mut self, modulus: Complex<T>)
%= operation. Read moreSource§impl<'a, T> RemAssign<&'a Complex<T>> for Complex<T>
impl<'a, T> RemAssign<&'a Complex<T>> for Complex<T>
Source§fn rem_assign(&mut self, other: &Complex<T>)
fn rem_assign(&mut self, other: &Complex<T>)
%= operation. Read moreSource§impl<'a, T> RemAssign<&'a T> for Complex<T>
impl<'a, T> RemAssign<&'a T> for Complex<T>
Source§fn rem_assign(&mut self, other: &T)
fn rem_assign(&mut self, other: &T)
%= operation. Read moreSource§impl<T> RemAssign<T> for Complex<T>
impl<T> RemAssign<T> for Complex<T>
Source§fn rem_assign(&mut self, other: T)
fn rem_assign(&mut self, other: T)
%= operation. Read moreSource§impl<T> Scalar for Complex<T>where
T: Native,
impl<T> Scalar for Complex<T>where
T: Native,
fn conj(self) -> Complex<T>
fn re(self) -> T
fn im(self) -> T
fn from_real(x: T) -> Complex<T>
Source§fn abs1(self) -> T
fn abs1(self) -> T
|re| + |im|, within a factor of √2 of the modulus and cheaper. Pivot searches and scaling compare it.Source§fn modulus(self) -> T
fn modulus(self) -> T
|self|, computed without overflow where the result fits, as hypot computes it.fn mul_real(self, x: T) -> Complex<T>
fn div_real(self, x: T) -> Complex<T>
Source§fn mul_acc(self, b: Complex<T>, c: Complex<T>) -> Complex<T>
fn mul_acc(self, b: Complex<T>, c: Complex<T>) -> Complex<T>
self × b + c, each multiply-add rounding once where FUSED is true, as Core::mla does.fn reciprocal(self) -> Complex<T>
impl<T> StructuralPartialEq for Complex<T>where
T: PartialEq,
Source§impl<T> SubAssign for Complex<T>
impl<T> SubAssign for Complex<T>
Source§fn sub_assign(&mut self, other: Complex<T>)
fn sub_assign(&mut self, other: Complex<T>)
-= operation. Read moreSource§impl<'a, T> SubAssign<&'a Complex<T>> for Complex<T>
impl<'a, T> SubAssign<&'a Complex<T>> for Complex<T>
Source§fn sub_assign(&mut self, other: &Complex<T>)
fn sub_assign(&mut self, other: &Complex<T>)
-= operation. Read moreSource§impl<'a, T> SubAssign<&'a T> for Complex<T>
impl<'a, T> SubAssign<&'a T> for Complex<T>
Source§fn sub_assign(&mut self, other: &T)
fn sub_assign(&mut self, other: &T)
-= operation. Read moreSource§impl<T> SubAssign<T> for Complex<T>
impl<T> SubAssign<T> for Complex<T>
Source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
-= operation. Read moreSource§impl Ternary<Complex<f32>> for Choose
impl Ternary<Complex<f32>> for Choose
fn one(&self, x: Complex<f32>, y: Complex<f32>, m: Complex<f32>) -> Complex<f32>
fn judged( &self, x: Complex<f32>, y: Complex<f32>, m: Complex<f32>, ) -> (Complex<f32>, bool)
fn slice( &self, args: [Arg<'_, Complex<f32>>; 3], n: usize, out: &mut [MaybeUninit<Complex<f32>>], ) -> bool
fn checked(&self, x: T, y: T, z: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, z: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
z: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Ternary<Complex<f64>> for Choose
impl Ternary<Complex<f64>> for Choose
fn one(&self, x: Complex<f64>, y: Complex<f64>, m: Complex<f64>) -> Complex<f64>
fn judged( &self, x: Complex<f64>, y: Complex<f64>, m: Complex<f64>, ) -> (Complex<f64>, bool)
fn slice( &self, args: [Arg<'_, Complex<f64>>; 3], n: usize, out: &mut [MaybeUninit<Complex<f64>>], ) -> bool
fn checked(&self, x: T, y: T, z: T) -> Option<Self::Out>
fn many( &self, x: Arg<'_, T>, y: Arg<'_, T>, z: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>, ) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
y: Arg<'_, T>,
z: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl<T> ToPrimitive for Complex<T>where
T: ToPrimitive + Num,
impl<T> ToPrimitive for Complex<T>where
T: ToPrimitive + Num,
Source§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self to a usize. If the value cannot be
represented by a usize, then None is returned.Source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self to an isize. If the value cannot be
represented by an isize, then None is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self to a u8. If the value cannot be
represented by a u8, then None is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self to a u16. If the value cannot be
represented by a u16, then None is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self to a u32. If the value cannot be
represented by a u32, then None is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self to a u64. If the value cannot be
represented by a u64, then None is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self to an i8. If the value cannot be
represented by an i8, then None is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self to an i16. If the value cannot be
represented by an i16, then None is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self to an i32. If the value cannot be
represented by an i32, then None is returned.Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self to an i64. If the value cannot be
represented by an i64, then None is returned.Source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
self to a u128. If the value cannot be
represented by a u128 (u64 under the default implementation), then
None is returned. Read moreSource§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
self to an i128. If the value cannot be
represented by an i128 (i64 under the default implementation), then
None is returned. Read moreSource§impl Unary<Complex<f32>> for Floor
impl Unary<Complex<f32>> for Floor
fn one(&self, y: Complex<f32>) -> Complex<f32>
fn judged(&self, y: Complex<f32>) -> (Complex<f32>, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 1], n: usize, out: &mut [MaybeUninit<Complex<f32>>], ) -> bool
fn checked(&self, x: T) -> Option<Self::Out>
fn many(&self, x: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Unary<Complex<f32>> for Ceil
impl Unary<Complex<f32>> for Ceil
fn one(&self, y: Complex<f32>) -> Complex<f32>
fn judged(&self, y: Complex<f32>) -> (Complex<f32>, bool)
fn slice( &self, _: [Arg<'_, Complex<f32>>; 1], n: usize, out: &mut [MaybeUninit<Complex<f32>>], ) -> bool
fn checked(&self, x: T) -> Option<Self::Out>
fn many(&self, x: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Unary<Complex<f64>> for Floor
impl Unary<Complex<f64>> for Floor
fn one(&self, y: Complex<f64>) -> Complex<f64>
fn judged(&self, y: Complex<f64>) -> (Complex<f64>, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 1], n: usize, out: &mut [MaybeUninit<Complex<f64>>], ) -> bool
fn checked(&self, x: T) -> Option<Self::Out>
fn many(&self, x: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Source§impl Unary<Complex<f64>> for Ceil
impl Unary<Complex<f64>> for Ceil
fn one(&self, y: Complex<f64>) -> Complex<f64>
fn judged(&self, y: Complex<f64>) -> (Complex<f64>, bool)
fn slice( &self, _: [Arg<'_, Complex<f64>>; 1], n: usize, out: &mut [MaybeUninit<Complex<f64>>], ) -> bool
fn checked(&self, x: T) -> Option<Self::Out>
fn many(&self, x: Arg<'_, T>, n: usize, out: &mut Vec<Self::Out>) -> bool
fn many_into(
&self,
x: Arg<'_, T>,
n: usize,
out: &mut Slots<'_, Self::Out>,
) -> boolwhere
T: Copy,
Auto Trait Implementations§
impl<T> Forget for Complex<T>
impl<T> Freeze for Complex<T>where
T: Freeze,
impl<T> RefUnwindSafe for Complex<T>where
T: RefUnwindSafe,
impl<T> Send for Complex<T>where
T: Send,
impl<T> Sync for Complex<T>where
T: Sync,
impl<T> Unpin for Complex<T>where
T: Unpin,
impl<T> UnsafeUnpin for Complex<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Complex<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> ⓘ
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> ⓘ
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