CMSIS-DSP: Vector sorting algorithms

| CMSIS-DSP Version 1.10.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
Vector sorting algorithms
Support Functions

## Functions

void | arm_merge_sort_f32 (const arm_merge_sort_instance_f32 *S, float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
void | arm_merge_sort_init_f32 (arm_merge_sort_instance_f32 *S, arm_sort_dir dir, float32_t *buffer)
void | arm_sort_f32 (const arm_sort_instance_f32 *S, float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
| Generic sorting function. More...
void | arm_sort_init_f32 (arm_sort_instance_f32 *S, arm_sort_alg alg, arm_sort_dir dir)

## Description

Sort the elements of a vector

There are separate functions for floating-point, Q31, Q15, and Q7 data types.

## Function Documentation

void arm_merge_sort_f32 | ( | const arm_merge_sort_instance_f32 * | S,
|  | float32_t * | pSrc,
|  | float32_t * | pDst,
|  | uint32_t | blockSize
| ) |  |

Parameters

  [in] | S | points to an instance of the sorting structure.
  [in] | pSrc | points to the block of input data.
  [out] | pDst | points to the block of output data
  [in] | blockSize | number of samples to process.

Algorithm
  The merge sort algorithm is a comparison algorithm that divide the input array in sublists and merge them to produce longer sorted sublists until there is only one list remaining.

A work array is always needed. It must be allocated by the user
  linked to the instance at initialization time.

It's an in-place algorithm. In order to obtain an out-of-place
  function, a memcpy of the source vector is performed

void arm_merge_sort_init_f32 | ( | arm_merge_sort_instance_f32 * | S,
|  | arm_sort_dir | dir,
|  | float32_t * | buffer
| ) |  |

Parameters

  [in,out] | S | points to an instance of the sorting structure.
  [in] | dir | Sorting order.
  [in] | buffer | Working buffer.

void arm_sort_f32 | ( | const arm_sort_instance_f32 * | S,
|  | float32_t * | pSrc,
|  | float32_t * | pDst,
|  | uint32_t | blockSize
| ) |  |

Parameters

  [in] | S | points to an instance of the sorting structure.
  [in] | pSrc | points to the block of input data.
  [out] | pDst | points to the block of output data.
  [in] | blockSize | number of samples to process.

void arm_sort_init_f32 | ( | arm_sort_instance_f32 * | S,
|  | arm_sort_alg | alg,
|  | arm_sort_dir | dir
| ) |  |

Parameters

  [in,out] | S | points to an instance of the sorting structure.
  [in] | alg | Selected algorithm.
  [in] | dir | Sorting order.