Trait thermite_special::SimdVectorizedSpecialFunctions [−][src]
pub trait SimdVectorizedSpecialFunctions<S: Simd>: SimdVectorizedSpecialFunctionsPolicied<S> { fn tgamma(self) -> Self; fn lgamma(self) -> Self; fn digamma(self) -> Self; fn beta(self, y: Self) -> Self; fn hermite(self, n: u32) -> Self; fn hermitev(self, n: S::Vu32) -> Self; fn jacobi(self, alpha: Self, beta: Self, n: u32, m: u32) -> Self; fn legendre(self, n: u32, m: u32) -> Self; fn gaussian(self, a: Self, c: Self) -> Self; fn gaussian_integral(self, x1: Self, a: Self, c: Self) -> Self; fn bessel_j(self, n: u32) -> Self; fn bessel_y(self, n: u32) -> Self; }
Required methods
Computes the Gamma function (Γ(z)
) for any real input, for each value in a vector.
This implementation uses a few different behaviors to ensure the greatest precision where possible.
- For non-integer positive inputs, it uses the Lanczos approximation.
- For small non-integer negative inputs, it uses the recursive identity
Γ(z)=Γ(z+1)/z
untilz
is positive. - For large non-integer negative inputs, it uses the reflection formula
-π/(Γ(z)sin(πz)z)
. - For positive integers, it simply computes the factorial in a tight loop to ensure precision. Lookup tables could not be used with SIMD.
- At zero, the result will be positive or negative infinity based on the input sign (signed zero is a thing).
NOTE: The Gamma function is not defined for negative integers.
Computes the natural log of the Gamma function (ln(Γ(x))
) for any real positive input, for each value in a vector.
Computes the Digamma function ψ(x)
, the first derivative of ln(Γ(x))
, or ln(Γ(x)) d/dx
Computes the n-th degree physicists’ Hermite polynomial
H_n(x)
where x
is self
and n
is an unsigned integer representing the polynomial degree.
This uses the recurrence relation to compute the polynomial iteratively.
NOTE: Given a constant n
, LLVM will happily unroll and optimize the inner loop where possible.
Computes the n-th degree physicists’ Hermite polynomial
H_n(x)
where x
is self
and n
is a vector of unsigned integers representing the polynomial degree.
The polynomial is calculated independenty per-lane with the given degree in n
.
This uses the recurrence relation to compute the polynomial iteratively.
Computes the m-th derivative of the n-th degree Jacobi polynomial
A the special case where α and β are both zero, the Jacobi polynomial reduces to a Legendre polynomial.
NOTE: Given constant α, β or n
, LLVM will happily optimize those away and unroll loops.
Computes the m-th associated n-th degree Legendre polynomial, where m=0 signifies the regular n-th degree Legendre polynomial.
If m
is odd, the input is only valid between -1 and 1
NOTE: Given constant n
and/or m
, LLVM will happily unroll and optimize inner loops.
Internally, this is computed with jacobi
Computes the generic Gaussian function:
f(x) = a * e^(-1/2 * x^2/c^2)
fn gaussian_integral(self, x1: Self, a: Self, c: Self) -> Self
[src]
fn gaussian_integral(self, x1: Self, a: Self, c: Self) -> Self
[src]Integrates the generic Gaussian function from x0
(self
) to x1
NOTE: This uses the Gaussian form f(x) = a * e^(-1/2 * x^2/c^2)
, so if you offset x
by some amount,
make sure to do that here as well with x0
(self
) and x1
Computes the Bessel function of the first kind J_n(x)
with whole integer order n
.
NOTE: For n < 2
, this uses an efficient rational polynomial approximation.