Skip to main content

SpecializedRealPrimalMath

Trait SpecializedRealPrimalMath 

Source
pub trait SpecializedRealPrimalMath<E>: SpecializedRealSpecialMath<E> + PrimalProjection<Primal = Self> {
    // Required method
    fn langevin_d<P: Policy>(self) -> (Self, Self);

    // Provided methods
    fn spherical_harmonics_d_with<P: Policy, const L: usize, const N: usize>(
        table: &ShTable<Self, N>,
        x: Self,
        y: Self,
        z: Self,
        out: &mut [Self; N],
        ddx: &mut [Self; N],
        ddy: &mut [Self; N],
        ddz: &mut [Self; N],
    ) { ... }
    fn spherical_harmonics_d<P: Policy, const L: usize, const N: usize, const CS: bool>(
        x: Self,
        y: Self,
        z: Self,
        out: &mut [Self; N],
        ddx: &mut [Self; N],
        ddy: &mut [Self; N],
        ddz: &mut [Self; N],
    ) { ... }
    fn zernike_basis_d<P: Policy, const L: usize, const NORM: u8, const N: usize>(
        x: Self,
        y: Self,
        out: &mut [Self; N],
        ddx: &mut [Self; N],
        ddy: &mut [Self; N],
    ) { ... }
    fn softplus_d<P: Policy>(self, k: Self, rcp_k: Self) -> (Self, Self) { ... }
    fn gelu_d<P: Policy>(self, alpha: Self) -> (Self, Self) { ... }
    fn swish_d<P: Policy>(self, beta: Self) -> (Self, Self) { ... }
    fn algebraic_sigmoid_d_n<P: Policy, const N: usize>(self) -> (Self, Self) { ... }
    fn algebraic_sigmoid_d<P: Policy>(self, n: u32) -> (Self, Self) { ... }
    fn algebraic_swish_d<P: Policy>(self) -> (Self, Self) { ... }
}
Expand description

Value-and-derivative (_d) forms of the activation functions, for single-value real numbers.

Every method is a provided default returning (value, derivative); the value matches the like-named value-only function in SpecializedSpecialMath / SpecializedRealSpecialMath. Implemented (as an empty impl) only for primal types – not for derivative-carrying numbers like Dual, which obtain the derivative from the value form via automatic differentiation.

Required Methods§

Source

fn langevin_d<P: Policy>(self) -> (Self, Self)

L(x) and L'(x). The derivative falls out of the value’s own intermediates on both branches (see generic::langevin), so there is no default here that would recompute it.

Provided Methods§

Source

fn spherical_harmonics_d_with<P: Policy, const L: usize, const N: usize>( table: &ShTable<Self, N>, x: Self, y: Self, z: Self, out: &mut [Self; N], ddx: &mut [Self; N], ddy: &mut [Self; N], ddz: &mut [Self; N], )

spherical_harmonics_with plus the ambient Cartesian gradients, from a prebuilt table.

Source

fn spherical_harmonics_d<P: Policy, const L: usize, const N: usize, const CS: bool>( x: Self, y: Self, z: Self, out: &mut [Self; N], ddx: &mut [Self; N], ddy: &mut [Self; N], ddz: &mut [Self; N], )

spherical_harmonics plus the ambient Cartesian gradient of every harmonic. See sh_d_impl for the gradient semantics.

Source

fn zernike_basis_d<P: Policy, const L: usize, const NORM: u8, const N: usize>( x: Self, y: Self, out: &mut [Self; N], ddx: &mut [Self; N], ddy: &mut [Self; N], )

zernike_basis plus the Cartesian gradient of every mode. See zernike_basis_d_impl for the algorithm.

Source

fn softplus_d<P: Policy>(self, k: Self, rcp_k: Self) -> (Self, Self)

Source

fn gelu_d<P: Policy>(self, alpha: Self) -> (Self, Self)

Source

fn swish_d<P: Policy>(self, beta: Self) -> (Self, Self)

Source

fn algebraic_sigmoid_d_n<P: Policy, const N: usize>(self) -> (Self, Self)

Source

fn algebraic_sigmoid_d<P: Policy>(self, n: u32) -> (Self, Self)

The runtime twin of algebraic_sigmoid_d_n.

Source

fn algebraic_swish_d<P: Policy>(self) -> (Self, Self)

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Last built: 2026-09-08 21:35:55 UTC