/** * Applies this filter. * Input and output arrays may be the same array. * @param x input array. * @param y output array. */ public void apply(float[] x, float[] y) { Check.state(_h1!=null,"1D filter is available"); int nx1 = x.length; updateFfts(nx1); float[] xfft = new float[_nfft1+2]; copy(nx1,x,xfft); extrapolate(xfft); _fft1.realToComplex(-1,xfft,xfft); int nk1 = _nfft1/2+1; for (int ik1=0,k1r=0,k1i=1; ik1<nk1; ++ik1,k1r+=2,k1i+=2) { float xr = xfft[k1r]; float xi = xfft[k1i]; float hr = _h1fft[k1r]; float hi = _h1fft[k1i]; xfft[k1r] = xr*hr-xi*hi; xfft[k1i] = xr*hi+xi*hr; } if (!_filterCaching) _h1fft = null; _fft1.complexToReal(1,xfft,xfft); copy(nx1,xfft,y); }
int nx1 = x[0].length; int nx2 = x.length; updateFfts(nx1,nx2); float[][] xfft = new float[_nfft2][_nfft1+2]; copy(nx1,nx2,x,xfft);
int nx2 = x[0].length; int nx3 = x.length; updateFfts(nx1,nx2,nx3); float[][][] xfft = new float[_nfft3][_nfft2][_nfft1+2]; copy(nx1,nx2,nx3,x,xfft);