Skip to main content

SemiflowFloat

Trait SemiflowFloat 

Source
pub trait SemiflowFloat:
    Float
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign
    + Send
    + Sync
    + Copy
    + Debug
    + Display
    + PartialOrd
    + 'static {
Show 26 methods // Provided methods fn libm_exp(self) -> Self { ... } fn libm_exp2(self) -> Self { ... } fn libm_exp_m1(self) -> Self { ... } fn libm_ln(self) -> Self { ... } fn libm_ln_1p(self) -> Self { ... } fn libm_log2(self) -> Self { ... } fn libm_log10(self) -> Self { ... } fn libm_log(self, base: Self) -> Self { ... } fn libm_powf(self, e: Self) -> Self { ... } fn libm_powi(self, n: i32) -> Self { ... } fn libm_sin(self) -> Self { ... } fn libm_cos(self) -> Self { ... } fn libm_tan(self) -> Self { ... } fn libm_sin_cos(self) -> (Self, Self) { ... } fn libm_asin(self) -> Self { ... } fn libm_acos(self) -> Self { ... } fn libm_atan(self) -> Self { ... } fn libm_atan2(self, other: Self) -> Self { ... } fn libm_sinh(self) -> Self { ... } fn libm_cosh(self) -> Self { ... } fn libm_tanh(self) -> Self { ... } fn libm_asinh(self) -> Self { ... } fn libm_acosh(self) -> Self { ... } fn libm_atanh(self) -> Self { ... } fn libm_cbrt(self) -> Self { ... } fn libm_hypot(self, other: Self) -> Self { ... }
}
Expand description

Sealed scalar-float trait: the set of types accepted by generic semiflow types.

§Sealed design (ADR-0025, v0.9.0 Block D pilot)

Only f32 and f64 implement SemiflowFloat — explicit impl blocks, no blanket impl. This prevents accidental instantiation with Complex<f64> or other numeric types before the relevant ADR lands.

§Bound rationale

The supertrait list mirrors what every Chernoff kernel actually needs:

  • num_traits::Float — sqrt, abs, is_finite, floor, exp, ln, …
  • AddAssign + SubAssign + MulAssign + DivAssign — in-place BLAS operations in crate::State.
  • Send + Sync + Copy + 'static — grid and function types stored in structs, shared across thread boundaries when parallel is enabled.
  • Debug + Display — error messages include the offending value.
  • PartialOrd — comparisons in validation helpers (tau < 0, a(x) < 0).

§SIMD note

f64 uses AVX2/NEON SIMD paths (Catmull-Rom, K-kernel) when the simd feature is enabled. f32 uses scalar-only paths; a dedicated f32x8 intrinsic path is deferred to a future ADR.

§Example

use semiflow::float::SemiflowFloat;
fn sum_two<F: SemiflowFloat>(a: F, b: F) -> F { a + b }

// Both concrete float types work:
assert_eq!(sum_two(1.0_f64, 2.0_f64), 3.0_f64);
assert_eq!(sum_two(1.0_f32, 2.0_f32), 3.0_f32);

Provided Methods§

Source

fn libm_exp(self) -> Self

eˣ via libm: identical bits in std and no_std builds.

Source

fn libm_exp2(self) -> Self

2ˣ via libm: identical bits in std and no_std builds.

Source

fn libm_exp_m1(self) -> Self

eˣ − 1 via libm: identical bits in std and no_std builds.

Source

fn libm_ln(self) -> Self

ln x via libm: identical bits in std and no_std builds.

Source

fn libm_ln_1p(self) -> Self

ln(1 + x) via libm: identical bits in std and no_std builds.

Source

fn libm_log2(self) -> Self

log₂ x via libm: identical bits in std and no_std builds.

Source

fn libm_log10(self) -> Self

log₁₀ x via libm: identical bits in std and no_std builds.

Source

fn libm_log(self, base: Self) -> Self

log_base x = ln x / ln base via libm: identical bits in std and no_std builds.

Source

fn libm_powf(self, e: Self) -> Self

xᵉ via libm: identical bits in std and no_std builds.

Source

fn libm_powi(self, n: i32) -> Self

xⁿ by exponentiation by squaring: identical bits in std and no_std builds.

Source

fn libm_sin(self) -> Self

sin x via libm: identical bits in std and no_std builds.

Source

fn libm_cos(self) -> Self

cos x via libm: identical bits in std and no_std builds.

Source

fn libm_tan(self) -> Self

tan x via libm: identical bits in std and no_std builds.

Source

fn libm_sin_cos(self) -> (Self, Self)

(sin x, cos x) via libm: identical bits in std and no_std builds.

Source

fn libm_asin(self) -> Self

arcsin x via libm: identical bits in std and no_std builds.

Source

fn libm_acos(self) -> Self

arccos x via libm: identical bits in std and no_std builds.

Source

fn libm_atan(self) -> Self

arctan x via libm: identical bits in std and no_std builds.

Source

fn libm_atan2(self, other: Self) -> Self

atan2(self, other) via libm: identical bits in std and no_std builds.

Source

fn libm_sinh(self) -> Self

sinh x via libm: identical bits in std and no_std builds.

Source

fn libm_cosh(self) -> Self

cosh x via libm: identical bits in std and no_std builds.

Source

fn libm_tanh(self) -> Self

tanh x via libm: identical bits in std and no_std builds.

Source

fn libm_asinh(self) -> Self

arsinh x via libm: identical bits in std and no_std builds.

Source

fn libm_acosh(self) -> Self

arcosh x via libm: identical bits in std and no_std builds.

Source

fn libm_atanh(self) -> Self

artanh x via libm: identical bits in std and no_std builds.

Source

fn libm_cbrt(self) -> Self

∛x via libm: identical bits in std and no_std builds.

Source

fn libm_hypot(self, other: Self) -> Self

√(x² + y²) via libm: identical bits in std and no_std builds.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SemiflowFloat for f32

Source§

fn libm_exp(self) -> Self

Source§

fn libm_exp2(self) -> Self

Source§

fn libm_exp_m1(self) -> Self

Source§

fn libm_ln(self) -> Self

Source§

fn libm_ln_1p(self) -> Self

Source§

fn libm_log2(self) -> Self

Source§

fn libm_log10(self) -> Self

Source§

fn libm_log(self, base: Self) -> Self

Source§

fn libm_powf(self, e: Self) -> Self

Source§

fn libm_powi(self, n: i32) -> Self

Source§

fn libm_sin(self) -> Self

Source§

fn libm_cos(self) -> Self

Source§

fn libm_tan(self) -> Self

Source§

fn libm_sin_cos(self) -> (Self, Self)

Source§

fn libm_asin(self) -> Self

Source§

fn libm_acos(self) -> Self

Source§

fn libm_atan(self) -> Self

Source§

fn libm_atan2(self, other: Self) -> Self

Source§

fn libm_sinh(self) -> Self

Source§

fn libm_cosh(self) -> Self

Source§

fn libm_tanh(self) -> Self

Source§

fn libm_asinh(self) -> Self

Source§

fn libm_acosh(self) -> Self

Source§

fn libm_atanh(self) -> Self

Source§

fn libm_cbrt(self) -> Self

Source§

fn libm_hypot(self, other: Self) -> Self

Source§

impl SemiflowFloat for f64

Source§

fn libm_exp(self) -> Self

Source§

fn libm_exp2(self) -> Self

Source§

fn libm_exp_m1(self) -> Self

Source§

fn libm_ln(self) -> Self

Source§

fn libm_ln_1p(self) -> Self

Source§

fn libm_log2(self) -> Self

Source§

fn libm_log10(self) -> Self

Source§

fn libm_log(self, base: Self) -> Self

Source§

fn libm_powf(self, e: Self) -> Self

Source§

fn libm_powi(self, n: i32) -> Self

Source§

fn libm_sin(self) -> Self

Source§

fn libm_cos(self) -> Self

Source§

fn libm_tan(self) -> Self

Source§

fn libm_sin_cos(self) -> (Self, Self)

Source§

fn libm_asin(self) -> Self

Source§

fn libm_acos(self) -> Self

Source§

fn libm_atan(self) -> Self

Source§

fn libm_atan2(self, other: Self) -> Self

Source§

fn libm_sinh(self) -> Self

Source§

fn libm_cosh(self) -> Self

Source§

fn libm_tanh(self) -> Self

Source§

fn libm_asinh(self) -> Self

Source§

fn libm_acosh(self) -> Self

Source§

fn libm_atanh(self) -> Self

Source§

fn libm_cbrt(self) -> Self

Source§

fn libm_hypot(self, other: Self) -> Self

Implementors§

Source§

impl<F: SemiflowFloat> SemiflowFloat for Dual<F>

Registers Dual<F> as a first-class member of the SemiflowFloat family.

This single impl makes every generic kernel accept F = Dual<f64>; no per-kernel ChernoffFunction impl is needed (§46, ADR-0133).