/ Drivers / CMSIS / DSP / Include / dsp / basic_math_functions_f16.h
basic_math_functions_f16.h
  1  /******************************************************************************
  2   * @file     basic_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  
 26   
 27  #ifndef _BASIC_MATH_FUNCTIONS_F16_H_
 28  #define _BASIC_MATH_FUNCTIONS_F16_H_
 29  
 30  #ifdef   __cplusplus
 31  extern "C"
 32  {
 33  #endif
 34  
 35  #include "arm_math_types_f16.h"
 36  #include "arm_math_memory.h"
 37  
 38  #include "dsp/none.h"
 39  #include "dsp/utils.h"
 40  
 41  
 42  #if defined(ARM_FLOAT16_SUPPORTED)
 43  
 44  
 45    /**
 46     * @brief Floating-point vector addition.
 47     * @param[in]  pSrcA      points to the first input vector
 48     * @param[in]  pSrcB      points to the second input vector
 49     * @param[out] pDst       points to the output vector
 50     * @param[in]  blockSize  number of samples in each vector
 51     */
 52    void arm_add_f16(
 53    const float16_t * pSrcA,
 54    const float16_t * pSrcB,
 55          float16_t * pDst,
 56          uint32_t blockSize);
 57  
 58    /**
 59     * @brief Floating-point vector subtraction.
 60     * @param[in]  pSrcA      points to the first input vector
 61     * @param[in]  pSrcB      points to the second input vector
 62     * @param[out] pDst       points to the output vector
 63     * @param[in]  blockSize  number of samples in each vector
 64     */
 65    void arm_sub_f16(
 66    const float16_t * pSrcA,
 67    const float16_t * pSrcB,
 68          float16_t * pDst,
 69          uint32_t blockSize);
 70  
 71      /**
 72     * @brief Multiplies a floating-point vector by a scalar.
 73     * @param[in]  pSrc       points to the input vector
 74     * @param[in]  scale      scale factor to be applied
 75     * @param[out] pDst       points to the output vector
 76     * @param[in]  blockSize  number of samples in the vector
 77     */
 78    void arm_scale_f16(
 79    const float16_t * pSrc,
 80          float16_t scale,
 81          float16_t * pDst,
 82          uint32_t blockSize);
 83  
 84      /**
 85     * @brief Floating-point vector absolute value.
 86     * @param[in]  pSrc       points to the input buffer
 87     * @param[out] pDst       points to the output buffer
 88     * @param[in]  blockSize  number of samples in each vector
 89     */
 90    void arm_abs_f16(
 91    const float16_t * pSrc,
 92          float16_t * pDst,
 93          uint32_t blockSize);
 94  
 95  
 96    /**
 97     * @brief  Adds a constant offset to a floating-point vector.
 98     * @param[in]  pSrc       points to the input vector
 99     * @param[in]  offset     is the offset to be added
100     * @param[out] pDst       points to the output vector
101     * @param[in]  blockSize  number of samples in the vector
102     */
103    void arm_offset_f16(
104    const float16_t * pSrc,
105          float16_t offset,
106          float16_t * pDst,
107          uint32_t blockSize);
108  
109    /**
110     * @brief Dot product of floating-point vectors.
111     * @param[in]  pSrcA      points to the first input vector
112     * @param[in]  pSrcB      points to the second input vector
113     * @param[in]  blockSize  number of samples in each vector
114     * @param[out] result     output result returned here
115     */
116    void arm_dot_prod_f16(
117    const float16_t * pSrcA,
118    const float16_t * pSrcB,
119          uint32_t blockSize,
120          float16_t * result);
121  
122    /**
123     * @brief Floating-point vector multiplication.
124     * @param[in]  pSrcA      points to the first input vector
125     * @param[in]  pSrcB      points to the second input vector
126     * @param[out] pDst       points to the output vector
127     * @param[in]  blockSize  number of samples in each vector
128     */
129    void arm_mult_f16(
130    const float16_t * pSrcA,
131    const float16_t * pSrcB,
132          float16_t * pDst,
133          uint32_t blockSize);
134  
135    /**
136     * @brief  Negates the elements of a floating-point vector.
137     * @param[in]  pSrc       points to the input vector
138     * @param[out] pDst       points to the output vector
139     * @param[in]  blockSize  number of samples in the vector
140     */
141    void arm_negate_f16(
142    const float16_t * pSrc,
143          float16_t * pDst,
144          uint32_t blockSize);
145  
146    /**
147    @brief         Elementwise floating-point clipping
148    @param[in]     pSrc          points to input values
149    @param[out]    pDst          points to output clipped values
150    @param[in]     low           lower bound
151    @param[in]     high          higher bound
152    @param[in]     numSamples    number of samples to clip
153    @return        none
154   */
155  
156  void arm_clip_f16(const float16_t * pSrc, 
157    float16_t * pDst, 
158    float16_t low, 
159    float16_t high, 
160    uint32_t numSamples);
161  
162  #endif /* defined(ARM_FLOAT16_SUPPORTED)*/
163  
164  #ifdef   __cplusplus
165  }
166  #endif
167  
168  #endif /* ifndef _BASIC_MATH_FUNCTIONS_F16_H_ */