summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/statisticsFunctions/moment/dmoments.c
blob: b9d8564a89c2112376e990ac4891d1c0dfbf1505 (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"


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

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

    return sum/size;
}