1 /******************************************************************************
2  * @file     bayes_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 BAYES_FUNCTIONS_F16_H_
28 #define BAYES_FUNCTIONS_F16_H_
29 
30 #include "arm_math_types_f16.h"
31 #include "arm_math_memory.h"
32 
33 #include "dsp/none.h"
34 #include "dsp/utils.h"
35 
36 #include "dsp/statistics_functions_f16.h"
37 
38 #ifdef   __cplusplus
39 extern "C"
40 {
41 #endif
42 
43 #if defined(ARM_FLOAT16_SUPPORTED)
44 
45 /**
46  * @brief Instance structure for Naive Gaussian Bayesian estimator.
47  */
48 typedef struct
49 {
50   uint32_t vectorDimension;  /**< Dimension of vector space */
51   uint32_t numberOfClasses;  /**< Number of different classes  */
52   const float16_t *theta;          /**< Mean values for the Gaussians */
53   const float16_t *sigma;          /**< Variances for the Gaussians */
54   const float16_t *classPriors;    /**< Class prior probabilities */
55   float16_t epsilon;         /**< Additive value to variances */
56 } arm_gaussian_naive_bayes_instance_f16;
57 
58 /**
59  * @brief Naive Gaussian Bayesian Estimator
60  *
61  * @param[in]  S                        points to a naive bayes instance structure
62  * @param[in]  in                       points to the elements of the input vector.
63  * @param[out] *pOutputProbabilities    points to a buffer of length numberOfClasses containing estimated probabilities
64  * @param[out] *pBufferB                points to a temporary buffer of length numberOfClasses
65  * @return The predicted class
66  */
67 uint32_t arm_gaussian_naive_bayes_predict_f16(const arm_gaussian_naive_bayes_instance_f16 *S,
68    const float16_t * in,
69    float16_t *pOutputProbabilities,
70    float16_t *pBufferB);
71 
72 #endif /*defined(ARM_FLOAT16_SUPPORTED)*/
73 #ifdef   __cplusplus
74 }
75 #endif
76 
77 #endif /* ifndef _BAYES_FUNCTIONS_F16_H_ */
78