CMSIS-DSP: Float Distances

| CMSIS-DSP Version 1.8.0 CMSIS DSP Software Library

- Main Page
- Usage and Description
- Reference

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Float Distances
Distance functions

## Functions

float32_t | arm_canberra_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Canberra distance between two vectors. More...
float32_t | arm_chebyshev_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Chebyshev distance between two vectors. More...
float32_t | arm_cityblock_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Cityblock (Manhattan) distance between two vectors. More...
float32_t | arm_correlation_distance_f32 (float32_t *pA, float32_t *pB, uint32_t blockSize)
| Correlation distance between two vectors. More...
float32_t | arm_cosine_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Cosine distance between two vectors. More...
float32_t | arm_euclidean_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Euclidean distance between two vectors. More...
__STATIC_INLINE float32_t | rel_entr (float32_t x, float32_t y)
float32_t | arm_jensenshannon_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Jensen-Shannon distance between two vectors. More...
float32_t | arm_minkowski_distance_f32 (const float32_t *pA, const float32_t *pB, int32_t order, uint32_t blockSize)
| Minkowski distance between two vectors. More...
float32_t | arm_braycurtis_distance_f32 (const float32_t *pA, const float32_t *pB, uint32_t blockSize)
| Bray-Curtis distance between two vectors. More...

## Description

Distances between two vectors of float values.

## Function Documentation

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

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

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

This function may divide by zero when samples pA[i] and pB[i] are both zero. The result of the computation will be correct. So the division per zero may be ignored.

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

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

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

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

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

float32_t arm_correlation_distance_f32 | ( | float32_t * | pA,
|  | float32_t * | pB,
|  | uint32_t | blockSize
| ) |  |

The input vectors are modified in place !

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

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

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | blockSize | vector length

Returns
  distance

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

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

float32_t arm_minkowski_distance_f32 | ( | const float32_t * | pA,
|  | const float32_t * | pB,
|  | int32_t | order,
|  | uint32_t | blockSize
| ) |  |

Parameters

  [in] | pA | First vector
  [in] | pB | Second vector
  [in] | order | Distance order
  [in] | blockSize | Number of samples

Returns
  distance

__STATIC_INLINE float32_t rel_entr | ( | float32_t | x,
|  | float32_t | y
| ) |  |