/** * Applies this filter along the 2nd dimension in the forward 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 apply2Forward(float[][] x, float[][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate2Forward(x,y); }
/** * Applies this filter along the 2nd dimension in the forward 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 apply2Forward(float[][][] x, float[][][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate2Forward(x,y); }
/** * Accumulates output in 2nd dimension in the forward 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 accumulate2Forward(float[][][] x, float[][][] y) { checkArrays(x,y); int n3 = y.length; for (int i3=0; i3<n3; ++i3) { accumulate2Forward(x[i3],y[i3]); } }
/** * Applies this filter along the 2nd 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 apply2ForwardReverse(float[][] x, float[][] y) { scale(_c*_g,x,y); for (int i2=0; i2<_n2; i2+=2) { _f2[i2 ].accumulate2Forward(x,y); _f2[i2+1].accumulate2Reverse(x,y); } }
/** * Applies this filter along the 2nd 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 apply2ForwardReverse(float[][][] x, float[][][] y) { scale(_c*_g,x,y); for (int i2=0; i2<_n2; i2+=2) { _f2[i2 ].accumulate2Forward(x,y); _f2[i2+1].accumulate2Reverse(x,y); } }
void applyXN(int nd, float[][] x, float[][] y) { checkArrays(x,y); if (sameArrays(x,y)) x = copy(x); _g[nd][0][0].apply2Forward(x,y); _g[nd][0][1].accumulate2Reverse(x,y); _g[nd][1][0].accumulate2Forward(x,y); _g[nd][1][1].accumulate2Reverse(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.accumulate2Forward(y2,y2); y2 = transpose12(y2); assertEqual(y1,y2);