arm_sort_f32.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_sort_f32.c
  4. * Description: Floating point sort
  5. *
  6. * $Date: 23 April 2021
  7. * $Revision: V1.9.0
  8. *
  9. * Target Processor: Cortex-M and Cortex-A cores
  10. * -------------------------------------------------------------------- */
  11. /*
  12. * Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
  13. *
  14. * SPDX-License-Identifier: Apache-2.0
  15. *
  16. * Licensed under the Apache License, Version 2.0 (the License); you may
  17. * not use this file except in compliance with the License.
  18. * You may obtain a copy of the License at
  19. *
  20. * www.apache.org/licenses/LICENSE-2.0
  21. *
  22. * Unless required by applicable law or agreed to in writing, software
  23. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  24. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  25. * See the License for the specific language governing permissions and
  26. * limitations under the License.
  27. */
  28. #include "arm_sorting.h"
  29. /**
  30. @ingroup groupSupport
  31. */
  32. /**
  33. @addtogroup Sorting
  34. @{
  35. */
  36. /**
  37. * @brief Generic sorting function
  38. *
  39. * @param[in] S points to an instance of the sorting structure.
  40. * @param[in] pSrc points to the block of input data.
  41. * @param[out] pDst points to the block of output data.
  42. * @param[in] blockSize number of samples to process.
  43. */
  44. void arm_sort_f32(
  45. const arm_sort_instance_f32 * S,
  46. float32_t * pSrc,
  47. float32_t * pDst,
  48. uint32_t blockSize)
  49. {
  50. switch(S->alg)
  51. {
  52. case ARM_SORT_BITONIC:
  53. arm_bitonic_sort_f32(S, pSrc, pDst, blockSize);
  54. break;
  55. case ARM_SORT_BUBBLE:
  56. arm_bubble_sort_f32(S, pSrc, pDst, blockSize);
  57. break;
  58. case ARM_SORT_HEAP:
  59. arm_heap_sort_f32(S, pSrc, pDst, blockSize);
  60. break;
  61. case ARM_SORT_INSERTION:
  62. arm_insertion_sort_f32(S, pSrc, pDst, blockSize);
  63. break;
  64. case ARM_SORT_QUICK:
  65. arm_quick_sort_f32(S, pSrc, pDst, blockSize);
  66. break;
  67. case ARM_SORT_SELECTION:
  68. arm_selection_sort_f32(S, pSrc, pDst, blockSize);
  69. break;
  70. }
  71. }
  72. /**
  73. @} end of Sorting group
  74. */