/** * 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); }
/** * For experimental use only. * @param x array of x-coordinates. * @param y array of y-coordinates. */ public void applyFrf(float[] x, float[] y) { scale(_c*_g,x,y); for (int i2=0; i2<_n2; i2+=2) { _f2[i2 ].accumulateForward(x,y); //_f2[i2+1].accumulateReverse(x,y); } }
void assertEquals(Real1 e, Real1 a) { Sampling se = e.getSampling(); Sampling sa = a.getSampling(); assertTrue(sa.isEquivalentTo(se)); float[] ve = e.getValues(); float[] va = a.getValues(); int n = ve.length; for (int i=0; i<n; ++i) assertEquals(ve[i],va[i],TINY); } }
public void testD22() { LocalDiffusionKernel ldk = new LocalDiffusionKernel(LocalDiffusionKernel.Stencil.D22); testSpd2(ldk); testSpd3(ldk); testSpd2RandomTensors(ldk); }
public void testSymmetric33() { double[][] v = new double[3][3]; double[] d = new double[3]; int nrand = 10000; for (int irand=0; irand<nrand; ++irand) { //double[][] a = randdouble(3,3); //a = add(a,transpose(a)); double[][] a = makeRandomSymmetric33(); Eigen.solveSymmetric33(a,v,d); check(a,v,d); } }
public void testFactorFomelExample() { float[] r = {24.0f,242.0f,867.0f,1334.0f,867.0f,242.0f,24.0f}; int[] lag1 = {0,1,2,3}; CausalFilter cf = new CausalFilter(lag1); cf.factorWilsonBurg(10,0.0f,r); float[] a = cf.getA(); assertEquals(24.0f,a[0],10*FLT_EPSILON); assertEquals(26.0f,a[1],10*FLT_EPSILON); assertEquals( 9.0f,a[2],10*FLT_EPSILON); assertEquals( 1.0f,a[3],10*FLT_EPSILON); }
/** * Applies this filter along the 1st 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 apply1Forward(float[][][] x, float[][][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate1Forward(x,y); }
/** * Applies this filter along the 3rd 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 apply3Forward(float[][][] x, float[][][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate3Forward(x,y); }
/** * Applies this filter. * Input and output arrays may be the same array. * @param x input array. * @param y output filtered array. */ public void apply(float[][][] x, float[][][] y) { updateFilter3(); _ff3.apply(x,y); }
/** * Applies this filter in the reverse direction. * Input and output arrays must be distinct arrays. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void applyReverse(float[] x, float[] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulateReverse(x,y); }
/** * Applies this filter along the 3rd 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 apply3Reverse(float[][][] x, float[][][] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulate3Reverse(x,y); }
/** * Applies this filter. * Input and output arrays may be the same array. * @param x input array. * @param y output filtered array. */ public void apply(float[] x, float[] y) { updateFilter1(); _ff1.apply(x,y); }
public void testErrorAndFrequency() { for (double emax:_emaxs) { for (double fmax:_fmaxs) { SincInterpolator si = SincInterpolator.fromErrorAndFrequency(emax,fmax); testInterpolator(si); } } }
private void smoothL(double kmax, float[][] x, float[][] y) { ensureLowpassFilter(kmax); _lpf.apply(x,y); } private void smoothL(double kmax, float[][][] x, float[][][] y) {
public void testFrequencyAndLength() { for (double fmax:_fmaxs) { for (int lmax:_lmaxs) { if ((1.0-2.0*fmax)*lmax>1.0) { SincInterpolator si = SincInterpolator.fromFrequencyAndLength(fmax,lmax); testInterpolator(si); } } } }
/** * 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 in the forward direction. * Input and output arrays must be distinct arrays. * Lengths of the input and output arrays must be equal. * @param x the input array. * @param y the output array. */ public void applyForward(float[] x, float[] y) { scale(_c,x,y); for (int i1=0; i1<_n1; ++i1) _f1[i1].accumulateForward(x,y); }
private void smoothL(double kmax, float[][][] x, float[][][] y) { ensureLowpassFilter(kmax); _lpf.apply(x,y); } private void ensureLowpassFilter(double kmax) {