NMSIS-DSP  Version 1.2.0
NMSIS DSP Software Library

LogSumExp optimizations to compute sum of probabilities with Gaussian distributions. More...

Functions

float16_t riscv_logsumexp_dot_prod_f16 (const float16_t *pSrcA, const float16_t *pSrcB, uint32_t blockSize, float16_t *pTmpBuffer)
 Dot product with log arithmetic. More...
 
float32_t riscv_logsumexp_dot_prod_f32 (const float32_t *pSrcA, const float32_t *pSrcB, uint32_t blockSize, float32_t *pTmpBuffer)
 Dot product with log arithmetic. More...
 
float16_t riscv_logsumexp_f16 (const float16_t *in, uint32_t blockSize)
 Computation of the LogSumExp. More...
 
float32_t riscv_logsumexp_f32 (const float32_t *in, uint32_t blockSize)
 Computation of the LogSumExp. More...
 

Detailed Description

LogSumExp optimizations to compute sum of probabilities with Gaussian distributions.

Function Documentation

◆ riscv_logsumexp_dot_prod_f16()

float16_t riscv_logsumexp_dot_prod_f16 ( const float16_t *  pSrcA,
const float16_t *  pSrcB,
uint32_t  blockSize,
float16_t *  pTmpBuffer 
)

Dot product with log arithmetic.

Vectors are containing the log of the samples

Parameters
[in]*pSrcApoints to the first input vector
[in]*pSrcBpoints to the second input vector
[in]blockSizenumber of samples in each vector
[in]*pTmpBuffertemporary buffer of length blockSize
Returns
The log of the dot product.

◆ riscv_logsumexp_dot_prod_f32()

float32_t riscv_logsumexp_dot_prod_f32 ( const float32_t *  pSrcA,
const float32_t *  pSrcB,
uint32_t  blockSize,
float32_t *  pTmpBuffer 
)

Dot product with log arithmetic.

Vectors are containing the log of the samples

Parameters
[in]*pSrcApoints to the first input vector
[in]*pSrcBpoints to the second input vector
[in]blockSizenumber of samples in each vector
[in]*pTmpBuffertemporary buffer of length blockSize
Returns
The log of the dot product.

◆ riscv_logsumexp_f16()

float16_t riscv_logsumexp_f16 ( const float16_t *  in,
uint32_t  blockSize 
)

Computation of the LogSumExp.

In probabilistic computations, the dynamic of the probability values can be very wide because they come from gaussian functions. To avoid underflow and overflow issues, the values are represented by their log. In this representation, multiplying the original exp values is easy : their logs are added. But adding the original exp values is requiring some special handling and it is the goal of the LogSumExp function.

If the values are x1...xn, the function is computing:

ln(exp(x1) + ... + exp(xn)) and the computation is done in such a way that rounding issues are minimised.

The max xm of the values is extracted and the function is computing: xm + ln(exp(x1 - xm) + ... + exp(xn - xm))

Parameters
[in]*inPointer to an array of input values.
[in]blockSizeNumber of samples in the input array.
Returns
LogSumExp

◆ riscv_logsumexp_f32()

float32_t riscv_logsumexp_f32 ( const float32_t *  in,
uint32_t  blockSize 
)

Computation of the LogSumExp.

In probabilistic computations, the dynamic of the probability values can be very wide because they come from gaussian functions. To avoid underflow and overflow issues, the values are represented by their log. In this representation, multiplying the original exp values is easy : their logs are added. But adding the original exp values is requiring some special handling and it is the goal of the LogSumExp function.

If the values are x1...xn, the function is computing:

ln(exp(x1) + ... + exp(xn)) and the computation is done in such a way that rounding issues are minimised.

The max xm of the values is extracted and the function is computing: xm + ln(exp(x1 - xm) + ... + exp(xn - xm))

Parameters
[in]*inPointer to an array of input values.
[in]blockSizeNumber of samples in the input array.
Returns
LogSumExp