CMSIS-DSP: Jensen-Shannon distance

| CMSIS-DSP CMSIS DSP Software Library

- Main Page
- Usage and Description
- Reference

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Jensen-Shannon distance
Float Distances

## Functions

float16_t | arm_jensenshannon_distance_f16 (const float16_t *pA, const float16_t *pB, uint32_t blockSize)
| Jensen-Shannon distance between two vectors. More...
float32_t | arm_jensenshannon_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Jensen-Shannon distance between two vectors. More...

## Description

Jensen-Shannon distance

## Function Documentation

float16_t arm_jensenshannon_distance_f16 | ( | const float16_t * | pA,
|  | const float16_t * | pB,
|  | uint32_t | blockSize
| ) |  |

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] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

float32_t arm_jensenshannon_distance_f32 | ( | const float32_t * | pA,
|  | const float32_t * | pB,
|  | uint32_t | blockSize
| ) |  |

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] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance