Commit bc00d195 authored by Christophe Favergeon's avatar Christophe Favergeon
Browse files

Correct issue #198 : weighted sum is a weighted average

parent fc6da815
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -499,16 +499,16 @@ const q7_t * pSrc,


/**
 * @brief Weighted sum
 * @brief Weighted average
 *
 *
 * @param[in]    *in           Array of input values.
 * @param[in]    *weigths      Weights
 * @param[in]    blockSize     Number of samples in the input array.
 * @return Weighted sum
 * @return Weighted average
 *
 */
float32_t arm_weighted_sum_f32(const float32_t *in
float32_t arm_weighted_average_f32(const float32_t *in
  , const float32_t *weigths
  , uint32_t blockSize);

+3 −3
Original line number Diff line number Diff line
@@ -113,13 +113,13 @@ void arm_f16_to_float(const float16_t * pSrc, float32_t * pDst, uint32_t blockSi


/**
 * @brief Weighted sum
 * @brief Weighted average
 * @param[in]    *in           Array of input values.
 * @param[in]    *weigths      Weights
 * @param[in]    blockSize     Number of samples in the input array.
 * @return Weighted sum
 * @return Weighted average
 */
float16_t arm_weighted_sum_f16(const float16_t *in
float16_t arm_weighted_average_f16(const float16_t *in
  , const float16_t *weigths
  , uint32_t blockSize);

+3 −3
Original line number Diff line number Diff line
@@ -901,7 +901,7 @@ cmsis_arm_barycenter_f32(PyObject *obj, PyObject *args)
}

static PyObject *
cmsis_arm_weighted_sum_f32(PyObject *obj, PyObject *args)
cmsis_arm_weighted_average_f32(PyObject *obj, PyObject *args)
{

  PyObject *pSrcA=NULL; // input
@@ -919,7 +919,7 @@ cmsis_arm_weighted_sum_f32(PyObject *obj, PyObject *args)
    blockSize = arraySizepSrcA ;


    dst=arm_weighted_sum_f32(pSrcA_converted,pSrcB_converted,blockSize);
    dst=arm_weighted_average_f32(pSrcA_converted,pSrcB_converted,blockSize);
    PyObject* pDstOBJ=Py_BuildValue("f",dst);
    PyObject *pythonResult = Py_BuildValue("O",pDstOBJ);

@@ -993,7 +993,7 @@ static PyMethodDef CMSISDSPMethods[] = {
{"arm_sort_f32",  cmsis_arm_sort_f32, METH_VARARGS,""},
{"arm_sort_init_f32",  cmsis_arm_sort_init_f32, METH_VARARGS,""},
{"arm_barycenter_f32",  cmsis_arm_barycenter_f32, METH_VARARGS,""},
{"arm_weighted_sum_f32",  cmsis_arm_weighted_sum_f32, METH_VARARGS,""},
{"arm_weighted_average_f32",  cmsis_arm_weighted_average_f32, METH_VARARGS,""},

    {"error_out", (PyCFunction)error_out, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}        /* Sentinel */
+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ SupportFunctions/arm_quick_sort_f32.c
SupportFunctions/arm_selection_sort_f32.c
SupportFunctions/arm_sort_f32.c
SupportFunctions/arm_sort_init_f32.c
SupportFunctions/arm_weighted_sum_f32.c
SupportFunctions/arm_weighted_average_f32.c
)


@@ -59,7 +59,7 @@ target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f16_to_q15.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_q15_to_f16.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_float_to_f16.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f16_to_float.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_weighted_sum_f16.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_weighted_average_f16.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_barycenter_f16.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f16_to_f64.c)
target_sources(CMSISDSP PRIVATE SupportFunctions/arm_f64_to_f16.c)
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@
#include "arm_selection_sort_f32.c"
#include "arm_sort_f32.c"
#include "arm_sort_init_f32.c"
#include "arm_weighted_sum_f32.c"
#include "arm_weighted_average_f32.c"

#include "arm_f64_to_float.c"
#include "arm_f64_to_q31.c"
Loading