@@ -0,0 +1,972 @@
+package jeranvier.math.dsp.filters;%0A%0Aimport jeranvier.math.linearAlgebra.Vector;%0Aimport jeranvier.math.util.Complex;%0A%0Apublic class MovingAverage %7B%0A%09%0A%09public static Vector SimpleMovingAverage(Vector data, int windowRadius)%7B%0A%09%09Vector.Builder vb = new Vector.Builder(data.size());%0A%09%09%0A%09%09for(int i = 1; i %3C= windowRadius; i++)%7B%0A%09%09%09Complex sum = new Complex();%0A%09%09%09for(int j=1; j%3C=i+windowRadius; j++)%7B%0A%09%09%09%09sum = sum.add(data.get(j));%0A%09%09%09%7D%0A%09%09%09vb.set(i, sum.divideBy(i+windowRadius));%0A%09%09%7D%0A%09%09%0A%09%09for(int i = windowRadius+1; i %3C data.size()-windowRadius; i++)%7B%0A%09%09%09Complex sum = new Complex();%0A%09%09%09for(int j=i-windowRadius; j%3Ci+windowRadius; j++)%7B%0A%09%09%09%09sum = sum.add(data.get(j));%0A%09%09%09%7D%0A%09%09%09vb.set(i, sum.divideBy(2*windowRadius));%0A%09%09%7D%0A%09%09%0A%09%09for(int i = data.size()-windowRadius; i %3C= data.size(); i++)%7B%0A%09%09%09Complex sum = new Complex();%0A%09%09%09for(int j =i; j%3C=data.size(); j++)%7B%0A%09%09%09%09sum = sum.add(data.get(j));%0A%09%09%09%7D%0A%09%09%09vb.set(i, sum.divideBy(data.size()-i+1));%0A%09%09%7D%0A%09%09return vb.build();%09%0A%09%7D%0A%0A%7D%0A

ADD simple implementation of a moving average