summaryrefslogtreecommitdiff
path: root/src/c/statisticsFunctions/moment/smoments.c
blob: aee9dc9e659312e428db27d47ab7dbb9b12bcc64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "moment.h"


float smoments (float* inp, int size, double ord)
{
    float sum = 0;

    for(int i = 0; i < size; i++)
    {
        sum = sum + pow(inp[i], ord);
    }

    return sum/size;
}