MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::mx Namespace Reference

Classes

struct  mxint8
 MXINT8: a scale byte, then 32 two's-complement int8 elements. 33 bytes. More...
struct  mxfp4
 MXFP4: a scale byte, then 16 bytes of packed E2M1 elements in GGML's block_mxfp4 order (element j low nibble, element j + 16 high nibble of byte 1 + j). More...

Functions

float e8m0_to_float (std::uint8_t e) noexcept
 The value of an E8M0 scale byte: 2^(e - 127), or NaN for 0xFF.
float e2m1_to_float (std::uint8_t code) noexcept
 The value of an FP4 E2M1 code (low four bits of code): sign, two exponent bits with bias 1, one mantissa bit, and a subnormal at exponent 0.

Function Documentation

◆ e2m1_to_float()

float mtl::mx::e2m1_to_float ( std::uint8_t code)
inlinenoexcept

The value of an FP4 E2M1 code (low four bits of code): sign, two exponent bits with bias 1, one mantissa bit, and a subnormal at exponent 0.

◆ e8m0_to_float()

float mtl::mx::e8m0_to_float ( std::uint8_t e)
inlinenoexcept

The value of an E8M0 scale byte: 2^(e - 127), or NaN for 0xFF.