/** * Applies this filter along the 2nd dimension in the reverse direction. * Input and output arrays may be the same array. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void apply2Reverse(float[][][] x, float[][][] y) { _f1[0].apply2Reverse(x,y); for (int i1=1; i1<_n1; ++i1) _f1[i1].apply2Reverse(y,y); }
/** * Applies this filter along the 2nd dimension in the reverse direction. * Input and output arrays may be the same array. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void apply2Reverse(float[][] x, float[][] y) { _f1[0].apply2Reverse(x,y); for (int i1=1; i1<_n1; ++i1) _f1[i1].apply2Reverse(y,y); }
/** * Applies this filter in 2nd dimension in the reverse direction. * <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 apply2Reverse(float[][][] x, float[][][] y) { checkArrays(x,y); int n3 = y.length; for (int i3=0; i3<n3; ++i3) { apply2Reverse(x[i3],y[i3]); } }
/** * Applies this filter in 3rd dimension in the reverse direction. * <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 apply3Reverse(float[][][] x, float[][][] y) { checkArrays(x,y); int n3 = y.length; int n2 = y[0].length; int n1 = y[0][0].length; float[][] xy = new float[n3][n1]; for (int i2=0; i2<n2; ++i2) { get2(i2,x,xy); apply2Reverse(xy,xy); set2(i2,xy,y); } }
/** /** * Accumulates output in 3rd 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 accumulate3Reverse(float[][][] x, float[][][] y) { checkArrays(x,y); int n3 = y.length; int n2 = y[0].length; int n1 = y[0][0].length; float[][] xy = new float[n3][n1]; for (int i2=0; i2<n2; ++i2) { get2(i2,x,xy); apply2Reverse(xy,xy); acc2(i2,xy,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.apply2Reverse(y2,y2); rf.accumulate2Reverse(y2,y2); y2 = transpose12(y2);