/** * Applies this filter along the 1st dimension in the reverse direction. * Input and output arrays must be distinct regular arrays. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void apply1Reverse(float[][] x, float[][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate1Reverse(x,y); }
/** * Applies this filter along the 1st dimension in the reverse direction. * Input and output arrays must be distinct regular arrays. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void apply1Reverse(float[][][] x, float[][][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate1Reverse(x,y); }
/** * Accumulates output in 1st dimension in the reverse direction. * This method filters the input, and adds the result to the output; it * is most useful when implementing parallel forms of recursive filters. * <p> * Input and output arrays may be the same array, but must be * regular and have equal lengths. * @param x the input array. * @param y the output array. */ public void accumulate1Reverse(float[][][] x, float[][][] y) { checkArrays(x,y); int n3 = y.length; for (int i3=0; i3<n3; ++i3) { accumulate1Reverse(x[i3],y[i3]); } }
/** * Applies this filter along the 1st dimension in the forward and * reverse directions. * Input and output arrays must be distinct regular arrays. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void apply1ForwardReverse(float[][][] x, float[][][] y) { scale(_c*_g,x,y); for (int i2=0; i2<_n2; i2+=2) { _f2[i2 ].accumulate1Forward(x,y); _f2[i2+1].accumulate1Reverse(x,y); } }
/** * Applies this filter along the 1st dimension in the forward and * reverse directions. * Input and output arrays must be distinct regular arrays. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void apply1ForwardReverse(float[][] x, float[][] y) { scale(_c*_g,x,y); for (int i2=0; i2<_n2; i2+=2) { _f2[i2 ].accumulate1Forward(x,y); _f2[i2+1].accumulate1Reverse(x,y); } }
public void test2(float b0, float b1, float b2, float a1, float a2) { int n = 20; float[][] x,y1,y2; x = randfloat(n,n); Recursive2ndOrderFilter rf = new Recursive2ndOrderFilter(b0,b1,b2,a1,a2); y1 = copy(x); rf.apply1Forward(y1,y1); rf.accumulate1Forward(y1,y1); y2 = transpose(x); rf.apply2Forward(y2,y2); rf.accumulate2Forward(y2,y2); y2 = transpose(y2); assertEqual(y1,y2); y1 = copy(x); rf.apply1Reverse(y1,y1); rf.accumulate1Reverse(y1,y1); y2 = transpose(x); rf.apply2Reverse(y2,y2); rf.accumulate2Reverse(y2,y2); y2 = transpose(y2); assertEqual(y1,y2); }
rf.accumulate1Reverse(y1,y1);