fast_math_functions_f16.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /******************************************************************************
  2. * @file fast_math_functions_f16.h
  3. * @brief Public header file for CMSIS DSP Library
  4. * @version V1.10.0
  5. * @date 08 July 2021
  6. * Target Processor: Cortex-M and Cortex-A cores
  7. ******************************************************************************/
  8. /*
  9. * Copyright (c) 2010-2020 Arm Limited or its affiliates. All rights reserved.
  10. *
  11. * SPDX-License-Identifier: Apache-2.0
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the License); you may
  14. * not use this file except in compliance with the License.
  15. * You may obtain a copy of the License at
  16. *
  17. * www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  21. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. * See the License for the specific language governing permissions and
  23. * limitations under the License.
  24. */
  25. #ifndef _FAST_MATH_FUNCTIONS_F16_H_
  26. #define _FAST_MATH_FUNCTIONS_F16_H_
  27. #include "arm_math_types_f16.h"
  28. #include "arm_math_memory.h"
  29. #include "dsp/none.h"
  30. #include "dsp/utils.h"
  31. /* For sqrt_f32 */
  32. #include "dsp/fast_math_functions.h"
  33. #ifdef __cplusplus
  34. extern "C"
  35. {
  36. #endif
  37. #if defined(ARM_FLOAT16_SUPPORTED)
  38. /**
  39. * @addtogroup SQRT
  40. * @{
  41. */
  42. /**
  43. @brief Floating-point square root function.
  44. @param[in] in input value
  45. @param[out] pOut square root of input value
  46. @return execution status
  47. - \ref ARM_MATH_SUCCESS : input value is positive
  48. - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0
  49. */
  50. __STATIC_FORCEINLINE arm_status arm_sqrt_f16(
  51. float16_t in,
  52. float16_t * pOut)
  53. {
  54. float32_t r;
  55. arm_status status;
  56. status=arm_sqrt_f32((float32_t)in,&r);
  57. *pOut=(float16_t)r;
  58. return(status);
  59. }
  60. /**
  61. @} end of SQRT group
  62. */
  63. /**
  64. @brief Floating-point vector of log values.
  65. @param[in] pSrc points to the input vector
  66. @param[out] pDst points to the output vector
  67. @param[in] blockSize number of samples in each vector
  68. @return none
  69. */
  70. void arm_vlog_f16(
  71. const float16_t * pSrc,
  72. float16_t * pDst,
  73. uint32_t blockSize);
  74. /**
  75. @brief Floating-point vector of exp values.
  76. @param[in] pSrc points to the input vector
  77. @param[out] pDst points to the output vector
  78. @param[in] blockSize number of samples in each vector
  79. @return none
  80. */
  81. void arm_vexp_f16(
  82. const float16_t * pSrc,
  83. float16_t * pDst,
  84. uint32_t blockSize);
  85. /**
  86. @brief Floating-point vector of inverse values.
  87. @param[in] pSrc points to the input vector
  88. @param[out] pDst points to the output vector
  89. @param[in] blockSize number of samples in each vector
  90. @return none
  91. */
  92. void arm_vinverse_f16(
  93. const float16_t * pSrc,
  94. float16_t * pDst,
  95. uint32_t blockSize);
  96. /**
  97. @brief Arc tangent in radian of y/x using sign of x and y to determine right quadrant.
  98. @param[in] y y coordinate
  99. @param[in] x x coordinate
  100. @param[out] result Result
  101. @return error status.
  102. */
  103. arm_status arm_atan2_f16(float16_t y,float16_t x,float16_t *result);
  104. #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108. #endif /* ifndef _FAST_MATH_FUNCTIONS_F16_H_ */