Trait cubecl_core::frontend::Numeric

source ·
pub trait Numeric:
    Copy
    + Abs
    + Max
    + Min
    + Clamp
    + Remainder
    + ExpandElementBaseInit
    + CubePrimitive
    + LaunchArgExpand
    + AddAssign
    + SubAssign
    + MulAssign
    + DivAssign
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + PartialOrd
    + Index<UInt, Output = Self>
    + IndexMut<UInt, Output = Self>
    + Index<u32, Output = Self>
    + IndexMut<u32, Output = Self>
    + From<u32>
    + Add<u32, Output = Self>
    + Sub<u32, Output = Self>
    + Mul<u32, Output = Self>
    + Div<u32, Output = Self>
    + AddAssign<u32>
    + SubAssign<u32>
    + MulAssign<u32>
    + DivAssign<u32>
    + PartialOrd<u32>
    + PartialEq<u32> {
    type Primitive: ScalarArgSettings;

    // Provided methods
    fn from_int(_val: u32) -> Self { ... }
    fn from_vec<const D: usize>(_vec: [u32; D]) -> Self { ... }
    fn __expand_from_int(
        _context: &mut CubeContext,
        val: ExpandElementTyped<I64>,
    ) -> <Self as CubeType>::ExpandType { ... }
    fn __expand_from_vec<const D: usize>(
        context: &mut CubeContext,
        vec: [ExpandElementTyped<UInt>; D],
    ) -> <Self as CubeType>::ExpandType { ... }
}
Expand description

Type that encompasses both (unsigned or signed) integers and floats Used in kernels that should work for both.

Required Associated Types§

Provided Methods§

source

fn from_int(_val: u32) -> Self

Create a new constant numeric.

Note: since this must work for both integer and float only the less expressive of both can be created (int) If a number with decimals is needed, use Float::new.

This method panics when unexpanded. For creating an element with a val, use the new method of the sub type.

source

fn from_vec<const D: usize>(_vec: [u32; D]) -> Self

source

fn __expand_from_int( _context: &mut CubeContext, val: ExpandElementTyped<I64>, ) -> <Self as CubeType>::ExpandType

source

fn __expand_from_vec<const D: usize>( context: &mut CubeContext, vec: [ExpandElementTyped<UInt>; D], ) -> <Self as CubeType>::ExpandType

Object Safety§

This trait is not object safe.

Implementors§