NMSIS-DSP  Version 1.3.1
NMSIS DSP Software Library
Jensen-Shannon distance

Jensen-Shannon distance. More...

Functions

__STATIC_INLINE float16_t rel_entr (float16_t x, float16_t y)
 
RISCV_DSP_ATTRIBUTE float16_t riscv_jensenshannon_distance_f16 (const float16_t *pA, const float16_t *pB, uint32_t blockSize)
 Jensen-Shannon distance between two vectors. More...
 
__STATIC_INLINE float32_t rel_entr (float32_t x, float32_t y)
 
RISCV_DSP_ATTRIBUTE float32_t riscv_jensenshannon_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
 Jensen-Shannon distance between two vectors. More...
 

Detailed Description

Jensen-Shannon distance.

Function Documentation

◆ rel_entr() [1/2]

__STATIC_INLINE float16_t rel_entr ( float16_t  x,
float16_t  y 
)
private

◆ rel_entr() [2/2]

__STATIC_INLINE float32_t rel_entr ( float32_t  x,
float32_t  y 
)
private

◆ riscv_jensenshannon_distance_f16()

RISCV_DSP_ATTRIBUTE float16_t riscv_jensenshannon_distance_f16 ( const float16_t *  pA,
const float16_t *  pB,
uint32_t  blockSize 
)

Jensen-Shannon distance between two vectors.

This function is assuming that elements of second vector are > 0 and 0 only when the corresponding element of first vector is 0. Otherwise the result of the computation does not make sense and for speed reasons, the cases returning NaN or Infinity are not managed.

When the function is computing x log (x / y) with x == 0 and y == 0, it will compute the right result (0) but a division by zero will occur and should be ignored in client code.

Parameters
[in]pAFirst vector
[in]pBSecond vector
[in]blockSizevector length
Returns
distance

◆ riscv_jensenshannon_distance_f32()

RISCV_DSP_ATTRIBUTE float32_t riscv_jensenshannon_distance_f32 ( const float32_t pA,
const float32_t pB,
uint32_t  blockSize 
)

Jensen-Shannon distance between two vectors.

This function is assuming that elements of second vector are > 0 and 0 only when the corresponding element of first vector is 0. Otherwise the result of the computation does not make sense and for speed reasons, the cases returning NaN or Infinity are not managed.

When the function is computing x log (x / y) with x == 0 and y == 0, it will compute the right result (0) but a division by zero will occur and should be ignored in client code.

Parameters
[in]pAFirst vector
[in]pBSecond vector
[in]blockSizevector length
Returns
distance