summaryrefslogtreecommitdiff
path: root/src/c/statisticsFunctions/moment/zmoments.c
blob: 1b847376a25ae09f0e171f7107ebbe1ee0a1a280 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "moment.h"
#include "doubleComplex.h"
#include "floatComplex.h"
#include "pow.h"
#include "addition.h"
#include "division.h"


doubleComplex zmoments (doubleComplex* inp, int size, double ord)
{
    doubleComplex sum = DoubleComplex(0,0);

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

    return zrdivs(sum,size);
}