/** * Constructs a local causal filter for specified lag1 and lag2. * By default, all lag3 are assumed to be zero. * <p> * For j=0 only, lag1[j] and lag2[j] are zero. * All lag2[j] must be non-negative. * If lag2[j] is zero, then lag1[j] must be non-negative. * @param lag1 array of lags in 1st dimension. * @param lag2 array of lags in 2nd dimension. */ public LocalCausalFilter(int[] lag1, int[] lag2) { initLags(lag1,lag2); }
final float[] ar = { 1.00f, -1.80f, 0.81f}; // (1-0.9z)(1-0.9z) final float[] as = { 1.00f, -1.60f, 0.64f}; // (1-0.8z)(1-0.8z) LocalCausalFilter lcf = new LocalCausalFilter(lag1); LocalCausalFilter.A1 a1 = new LocalCausalFilter.A1() { public void get(int i1, float[] a) { float[] ax = zeros(n); float[] ay = zeros(n); lcf.apply(a1,x,ax); lcf.applyTranspose(a1,y,ay); float dyx = dot(y,ax); float dxy = dot(x,ay); float[] bx = zeros(n); float[] by = zeros(n); lcf.applyInverse(a1,x,bx); lcf.applyInverseTranspose(a1,y,by); float dyx = dot(y,bx); float dxy = dot(x,by); lcf.apply(a1,y,y); // in-place lcf.applyInverse(a1,y,y); // in-place assertEqual(x,y); lcf.applyInverseTranspose(a1,x,y); // *not* in-place lcf.applyTranspose(a1,y,y); // in-place assertEqual(x,y);
final float[] ar = mul(1.0f,aa); final float[] as = mul(2.0f,aa); LocalCausalFilter lcf = new LocalCausalFilter(lag1,lag2); LocalCausalFilter.A2 a2 = new LocalCausalFilter.A2() { public void get(int i1, int i2, float[] a) { float[][] ax = zeros(n1,n2); float[][] ay = zeros(n1,n2); lcf.apply(a2,x,ax); lcf.applyTranspose(a2,y,ay); float dyx = dot(y,ax); float dxy = dot(x,ay); float[][] bx = zeros(n1,n2); float[][] by = zeros(n1,n2); lcf.applyInverse(a2,x,bx); lcf.applyInverseTranspose(a2,y,by); float dyx = dot(y,bx); float dxy = dot(x,by); lcf.apply(a2,y,y); // in-place lcf.applyInverse(a2,y,y); // in-place assertEqual(x,y); lcf.applyInverseTranspose(a2,x,y); // *not* in-place lcf.applyTranspose(a2,y,y); // in-place assertEqual(x,y);
final float[] ar = mul(1.0f,aa); final float[] as = mul(2.0f,aa); LocalCausalFilter lcf = new LocalCausalFilter(lag1,lag2,lag3); LocalCausalFilter.A3 a3 = new LocalCausalFilter.A3() { public void get(int i1, int i2, int i3, float[] a) { float[][][] ax = zeros(n1,n2,n3); float[][][] ay = zeros(n1,n2,n3); lcf.apply(a3,x,ax); lcf.applyTranspose(a3,y,ay); float dyx = dot(y,ax); float dxy = dot(x,ay); float[][][] bx = zeros(n1,n2,n3); float[][][] by = zeros(n1,n2,n3); lcf.applyInverse(a3,x,bx); lcf.applyInverseTranspose(a3,y,by); float dyx = dot(y,bx); float dxy = dot(x,by); lcf.apply(a3,y,y); // in-place lcf.applyInverse(a3,y,y); // in-place assertEqual(x,y); lcf.applyInverseTranspose(a3,x,y); // *not* in-place lcf.applyTranspose(a3,y,y); // in-place assertEqual(x,y);
/** * Constructs a local causal filter for specified lag1. * By default, all lag2 and lag3 are assumed to be zero. * <p> * For j=0 only, lag1[j] is zero. * All lag1[j] must be non-negative. * @param lag1 array of lags. */ public LocalCausalFilter(int[] lag1) { initLags(lag1); }
/** * Constructs a local causal filter for specified lag1, lag2, and lag3. * <p> * For j=0 only, lag1[j] and lag2[j] and lag3[j] are zero. * All lag3[j] must be non-negative. * If lag3[j] is zero, then lag2[j] must be non-negative. * If lag3[j] and lag2[j] are zero, then lag1[j] must be non-negative. * @param lag1 array of lags in 1st dimension. * @param lag2 array of lags in 2nd dimension. * @param lag3 array of lags in 3rd dimension. */ public LocalCausalFilter(int[] lag1, int[] lag2, int[] lag3) { initLags(lag1,lag2,lag3); }