spinn_common 7.3.1
Support code for SpiNNaker applications.
|
Implementation of log for the accum type. More...
Functions | |
static int32_t | divide_ck (int32_t x, uint32_t k) |
This function divides x by k/64. | |
static uint32_t | uint32_round (uint32_t r, uint32_t n) |
Shift away a given number of bits, with rounding. | |
static int32_t | subtract_mult_log2 (int32_t r, int32_t x) |
This function performs a multiply-accumulate. | |
static int32_t | cubic_term (int32_t r) |
Computes the cubic term for log_1_2() | |
static uint32_t | log_1_2 (uint32_t x) |
This function calculates a range-reduced log function. | |
static int32_t | logkbits (int32_t x) |
This function calculates the internal representation of the log function. | |
accum | logk (accum x) |
Logarithm: log(x) for the accum type (s16.15). | |
Variables | |
static uint32_t | log_ck [] |
static int16_t | recip_table [] |
Reciprocal table. | |
Implementation of log for the accum type.
The details of the algorithm are from "Elementary Functions: Algorithms and Implemenation", 2nd edn, Jean-Michel Muller, Birkhauser, 2006.
|
inlinestatic |
This function divides x by k/64.
[in] | x | input value |
[in] | k | the ‘breakpoint’ index. |
|
inlinestatic |
Shift away a given number of bits, with rounding.
[in] | r | The number to be rounded. |
[in] | n | The number of least-significant bits to remove. Should be a constant for efficiency. |
|
inlinestatic |
This function performs a multiply-accumulate.
[in] | r | accumulator value |
[in] | x | one of the factors |
|
inlinestatic |
Computes the cubic term for log_1_2()
[in] | r | an s0.31 representation of the x/ck |
|
inlinestatic |
This function calculates a range-reduced log function.
[in] | x | a u0.31 fraction. |
|
inlinestatic |
This function calculates the internal representation of the log function.
[in] | x | a positive signed accum , in integer form. |
signed accum
). accum logk | ( | s1615 | x | ) |
Logarithm: log(x)
for the accum
type (s16.15).
[in] | x | Value to compute the logarithm of as an accum |
x
in accum
format
|
static |
\( ck = 1 + k/64 \)
Thus \( log_ck[k] = log(1 + k/64) + 12 \) in u5.27
|
static |
Reciprocal table.