Belle II Software development
NeuroTrigger3DH::TanhLUT Struct Reference

Static Public Member Functions

static int32_t get (std::size_t idx)
 

Static Public Attributes

static constexpr int LUT_INDEX_BITS = 12
 
static constexpr std::size_t LUT_SIZE = 1 << LUT_INDEX_BITS
 
static constexpr int LUT_FRAC_BITS = 12
 
static constexpr int LUT_SCALE = 1 << LUT_FRAC_BITS
 
static constexpr int MAX_FLOAT_SHIFT = 2
 
static constexpr int MAX_FLOAT = 1 << MAX_FLOAT_SHIFT
 
static constexpr int LUT_SATURATION = 1 << (LUT_FRAC_BITS + MAX_FLOAT_SHIFT)
 
static constexpr int HEADROOM_BITS = 3
 
static const std::array< int32_t, LUT_SIZE > table
 

Detailed Description

Definition at line 133 of file NeuroTrigger3DH.h.

Member Function Documentation

◆ get()

static int32_t get ( std::size_t idx)
inlinestatic

Definition at line 166 of file NeuroTrigger3DH.h.

166{ return table[idx]; }

Member Data Documentation

◆ HEADROOM_BITS

int HEADROOM_BITS = 3
staticconstexpr

Definition at line 150 of file NeuroTrigger3DH.h.

◆ LUT_FRAC_BITS

int LUT_FRAC_BITS = 12
staticconstexpr

Definition at line 139 of file NeuroTrigger3DH.h.

◆ LUT_INDEX_BITS

int LUT_INDEX_BITS = 12
staticconstexpr

Definition at line 135 of file NeuroTrigger3DH.h.

◆ LUT_SATURATION

int LUT_SATURATION = 1 << (LUT_FRAC_BITS + MAX_FLOAT_SHIFT)
staticconstexpr

Definition at line 145 of file NeuroTrigger3DH.h.

◆ LUT_SCALE

int LUT_SCALE = 1 << LUT_FRAC_BITS
staticconstexpr

Definition at line 140 of file NeuroTrigger3DH.h.

◆ LUT_SIZE

std::size_t LUT_SIZE = 1 << LUT_INDEX_BITS
staticconstexpr

Definition at line 136 of file NeuroTrigger3DH.h.

◆ MAX_FLOAT

int MAX_FLOAT = 1 << MAX_FLOAT_SHIFT
staticconstexpr

Definition at line 144 of file NeuroTrigger3DH.h.

◆ MAX_FLOAT_SHIFT

int MAX_FLOAT_SHIFT = 2
staticconstexpr

Definition at line 143 of file NeuroTrigger3DH.h.

◆ table

const std::array<int32_t, LUT_SIZE> table
inlinestatic
Initial value:
= []()
{
std::array<int32_t, LUT_SIZE> lut{};
for (std::size_t i = 0; i < LUT_SIZE; ++i) {
double input = MAX_FLOAT * static_cast<double>(i) / LUT_SIZE;
double val = std::tanh(input) * LUT_SCALE;
int32_t qval = static_cast<int32_t>(std::round(val));
qval = std::min<int32_t>(qval, (LUT_SCALE - 1));
lut[i] = qval;
}
return lut;
}()

Definition at line 152 of file NeuroTrigger3DH.h.

153 {
154 std::array<int32_t, LUT_SIZE> lut{};
155 for (std::size_t i = 0; i < LUT_SIZE; ++i) {
156 double input = MAX_FLOAT * static_cast<double>(i) / LUT_SIZE;
157 double val = std::tanh(input) * LUT_SCALE;
158 int32_t qval = static_cast<int32_t>(std::round(val));
159 // Clamp to maximum bit range [0, LUT_SCALE - 1] (maps LUT_SCALE -> LUT_SCALE - 1)
160 qval = std::min<int32_t>(qval, (LUT_SCALE - 1));
161 lut[i] = qval;
162 }
163 return lut;
164 }();

The documentation for this struct was generated from the following file: