Functions for conversion between 16-bit and 32-bit float numbers and other. More...
Functions | |
| SIMD_API void | SimdFloat32ToFloat16 (const float *src, size_t size, uint16_t *dst) |
| Converts numbers in the array from 32-bit float to 16-bit float format. More... | |
| SIMD_API void | SimdFloat16ToFloat32 (const uint16_t *src, size_t size, float *dst) |
| Converts numbers in the array from 16-bit float to 32-bit float format. More... | |
| SIMD_API void | SimdSquaredDifferenceSum16f (const uint16_t *a, const uint16_t *b, size_t size, float *sum) |
| Calculates sum of squared differences for two 16-bit float arrays. More... | |
| SIMD_API void | SimdCosineDistance16f (const uint16_t *a, const uint16_t *b, size_t size, float *distance) |
| Calculates cosine distance of two 16-bit float arrays. More... | |
Detailed Description
Functions for conversion between 16-bit and 32-bit float numbers and other.
Function Documentation
◆ SimdFloat32ToFloat16()
| void SimdFloat32ToFloat16 | ( | const float * | src, |
| size_t | size, | ||
| uint16_t * | dst | ||
| ) |
Converts numbers in the array from 32-bit float to 16-bit float format.
- Parameters
-
[in] src - a pointer to the input array with 32-bit float point numbers. [in] size - a size of input and output array. [out] dst - a pointer to the output array with 16-bit float point numbers.
◆ SimdFloat16ToFloat32()
| void SimdFloat16ToFloat32 | ( | const uint16_t * | src, |
| size_t | size, | ||
| float * | dst | ||
| ) |
Converts numbers in the array from 16-bit float to 32-bit float format.
- Parameters
-
[in] src - a pointer to the input array with 16-bit float point numbers. [in] size - a size of input and output array. [out] dst - a pointer to the output array with 32-bit float point numbers.
◆ SimdSquaredDifferenceSum16f()
| void SimdSquaredDifferenceSum16f | ( | const uint16_t * | a, |
| const uint16_t * | b, | ||
| size_t | size, | ||
| float * | sum | ||
| ) |
Calculates sum of squared differences for two 16-bit float arrays.
All arrays must have the same size.
For every element:
sum += (a[i] - b[i])*(a[i] - b[i]);
- Parameters
-
[in] a - a pointer to the first 16-bit float array. [in] b - a pointer to the second 16-bit float array. [in] size - a size of arrays. [out] sum - a pointer to 32-bit float point sum of squared differences.
◆ SimdCosineDistance16f()
| void SimdCosineDistance16f | ( | const uint16_t * | a, |
| const uint16_t * | b, | ||
| size_t | size, | ||
| float * | distance | ||
| ) |
Calculates cosine distance of two 16-bit float arrays.
All arrays must have the same size.
Algorithm description:
distance = 1 - Sum(a[i]*b[i])/Sqrt(Sum(a[i]*a[i])*Sum(b[i]*b[i]));
- Parameters
-
[in] a - a pointer to the first 16-bit float array. [in] b - a pointer to the second 16-bit float array. [in] size - a size of arrays. [out] distance - a pointer to 32-bit float with cosine distance.
