/* Jensen-Shannon distance between two vectors. 
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. */
float32_t arm_jensenshannon_distance_f32(const float32_t *pA, const float32_t *pB, uint32_t blockSize)
/* Jensen-Shannon distance between two vectors. 
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. */
float32_t arm_jensenshannon_distance_f32(const float32_t *pA, const float32_t *pB, uint32_t blockSize)
{
    float32_t left, right,sum, result, tmp;
    uint32_t i;
    left = 0.0f; 
    right = 0.0f;
    for(i=0; i < blockSize; i++)
    {
      tmp = (pA[i] + pB[i]) / 2.0f;
      left  += rel_entr(pA[i], tmp);
      right += rel_entr(pB[i], tmp);
    }
    sum = left + right;
    arm_sqrt_f32(sum/2.0f, &result);
    return(result);
}