int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && useThreads) { xdft3da_subth1(1, -1, a, true); cdft3db_subth(-1, a, true); rdft3d_sub(1, a); } else { xdft3da_sub1(1, -1, a, true); cdft3db_sub(-1, a, true); rdft3d_sub(1, a);
/** * Computes 3D forward DFT of real data leaving the result in <code>a</code> * . This method computes full real forward transform, i.e. you will get the * same result as from <code>complexForward</code> called with all imaginary * part equal 0. Because the result is stored in <code>a</code>, the input * array must be of size slices by rows by 2*columns, with only the first * slices by rows by columns elements filled with real data. To get back the * original data, use <code>complexInverse</code> on the output of this * method. * * @param a data to transform */ public void realForwardFull(double[][][] a) { if (isPowerOfTwo) { int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && useThreads) { xdft3da_subth2(1, -1, a, true); cdft3db_subth(-1, a, true); rdft3d_sub(1, a); } else { xdft3da_sub2(1, -1, a, true); cdft3db_sub(-1, a, true); rdft3d_sub(1, a); } fillSymmetric(a); } else { mixedRadixRealForwardFull(a); } }
/** * Computes 3D inverse DFT of real data leaving the result in <code>a</code> * . This method computes full real inverse transform, i.e. you will get the * same result as from <code>complexInverse</code> called with all imaginary * part equal 0. Because the result is stored in <code>a</code>, the input * array must be of size slices*rows*2*columns, with only the first * slices*rows*columns elements filled with real data. * * @param a data to transform * @param scale if true then scaling is performed */ public void realInverseFull(double[] a, boolean scale) { if (isPowerOfTwo) { int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && useThreads) { xdft3da_subth2(1, 1, a, scale); cdft3db_subth(1, a, scale); rdft3d_sub(1, a); } else { xdft3da_sub2(1, 1, a, scale); cdft3db_sub(1, a, scale); rdft3d_sub(1, a); } fillSymmetric(a); } else { mixedRadixRealInverseFull(a, scale); } }
rowStride = columns; if ((nthreads > 1) && useThreads) { xdft3da_subth2(0, -1, a, true); cdft3db_subth(-1, a, true); } else { xdft3da_sub2(0, -1, a, true); cdft3db_sub(-1, a, true);
System.out.println("Complex forward FFT 3D (input 3D) of size " + sizes3D[i] + " x " + sizes3D[i] + " x " + sizes3D[i]); if (doWarmup) { // call the transform twice to warm up DoubleFFT_3D fft3 = new DoubleFFT_3D(sizes3D[i], sizes3D[i], sizes3D[i]); x = new double[(int) sizes3D[i]][(int) sizes3D[i]][2 * (int) sizes3D[i]]; IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], 2 * sizes3D[i], x); fft3.complexForward(x); IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], 2 * sizes3D[i], x); fft3.complexForward(x); DoubleFFT_3D fft3 = new DoubleFFT_3D(sizes3D[i], sizes3D[i], sizes3D[i]); times_with_constructor[i] = (System.nanoTime() - elapsedTime) / 1000000.0; x = new double[(int) sizes3D[i]][(int) sizes3D[i]][2 * (int) sizes3D[i]]; IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], 2 * sizes3D[i], x); elapsedTime = System.nanoTime(); fft3.complexForward(x); elapsedTime = System.nanoTime() - elapsedTime; if (elapsedTime < min_time) {
System.out.println("Real forward FFT 3D (input 3D) of size " + sizes3D[i] + " x " + sizes3D[i] + " x " + sizes3D[i]); if (doWarmup) { // call the transform twice to warm up DoubleFFT_3D fft3 = new DoubleFFT_3D(sizes3D[i], sizes3D[i], sizes3D[i]); x = new double[(int) sizes3D[i]][(int) sizes3D[i]][2 * (int) sizes3D[i]]; IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x); fft3.realForwardFull(x); IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x); fft3.realForwardFull(x); DoubleFFT_3D fft3 = new DoubleFFT_3D(sizes3D[i], sizes3D[i], sizes3D[i]); times_with_constructor[i] = (System.nanoTime() - elapsedTime) / 1000000.0; x = new double[(int) sizes3D[i]][(int) sizes3D[i]][2 * (int) sizes3D[i]]; IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x); elapsedTime = System.nanoTime(); fft3.realForwardFull(x); elapsedTime = System.nanoTime() - elapsedTime; if (elapsedTime < min_time) {
/** * Computes the 3D inverse of the discrete Fourier transform (IDFT) of this * matrix. * * @param scale * if true then scaling is performed */ public void ifft3(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); } fft3.complexInverse(elements, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); fft3.realForward(elements); ConcurrencyUtils.setNumberOfThreads(oldNthreads);
fft3 = new DoubleFFT_3D(slices, rows, columns); fft3.realInverseFull(cElems, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads); return C;
ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); fft3.realInverse(elements, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads);
rowStride = columns; if ((nthreads > 1) && useThreads) { xdft3da_subth2(0, 1, a, scale); cdft3db_subth(1, a, scale); } else { xdft3da_sub2(0, 1, a, scale); cdft3db_sub(1, a, scale);
/** * Computes the 3D discrete Fourier transform (DFT) of this matrix. */ public void fft3() { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); } fft3.complexForward(elements); ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
System.out.println("Real forward FFT 3D (input 3D) of size " + sizes3D[i] + " x " + sizes3D[i] + " x " + sizes3D[i]); if (doWarmup) { // call the transform twice to warm up DoubleFFT_3D fft3 = new DoubleFFT_3D(sizes3D[i], sizes3D[i], sizes3D[i]); x = new double[(int) sizes3D[i]][(int) sizes3D[i]][2 * (int) sizes3D[i]]; IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x); fft3.realForwardFull(x); IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x); fft3.realForwardFull(x); DoubleFFT_3D fft3 = new DoubleFFT_3D(sizes3D[i], sizes3D[i], sizes3D[i]); times_with_constructor[i] = (System.nanoTime() - elapsedTime) / 1000000.0; x = new double[(int) sizes3D[i]][(int) sizes3D[i]][2 * (int) sizes3D[i]]; IOUtils.fillMatrix_3D(sizes3D[i], sizes3D[i], sizes3D[i], x); elapsedTime = System.nanoTime(); fft3.realForwardFull(x); elapsedTime = System.nanoTime() - elapsedTime; if (elapsedTime < min_time) {
/** * Computes the 3D inverse of the discrete Fourier transform (IDFT) of this * matrix. * * @param scale * if true then scaling is performed */ public void ifft3(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); } if (isNoView == true) { fft3.complexInverse(elements, scale); } else { DComplexMatrix3D copy = this.copy(); fft3.complexInverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); fft3.realForward(elements); } else { DoubleMatrix3D copy = this.copy(); fft3.realForward((double[]) copy.elements()); this.assign((double[]) copy.elements());
fft3 = new DoubleFFT_3D(slices, rows, columns); fft3.realInverseFull(cElems, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads); return C;
ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft3 == null) { fft3 = new DoubleFFT_3D(slices, rows, columns); fft3.realInverse(elements, scale); } else { DoubleMatrix3D copy = this.copy(); fft3.realInverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements());
int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && useThreads) { rdft3d_sub(-1, a); cdft3db_subth(1, a, scale); xdft3da_subth1(1, 1, a, scale); } else { rdft3d_sub(-1, a); cdft3db_sub(1, a, scale); xdft3da_sub1(1, 1, a, scale);
/** * Computes 3D forward DFT of real data leaving the result in <code>a</code> * . This method computes full real forward transform, i.e. you will get the * same result as from <code>complexForward</code> called with all imaginary * part equal 0. Because the result is stored in <code>a</code>, the input * array must be of size slices by rows by 2*columns, with only the first * slices by rows by columns elements filled with real data. To get back the * original data, use <code>complexInverse</code> on the output of this * method. * * @param a data to transform */ public void realForwardFull(double[][][] a) { if (isPowerOfTwo) { int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && useThreads) { xdft3da_subth2(1, -1, a, true); cdft3db_subth(-1, a, true); rdft3d_sub(1, a); } else { xdft3da_sub2(1, -1, a, true); cdft3db_sub(-1, a, true); rdft3d_sub(1, a); } fillSymmetric(a); } else { mixedRadixRealForwardFull(a); } }
/** * Computes 3D inverse DFT of real data leaving the result in <code>a</code> * . This method computes full real inverse transform, i.e. you will get the * same result as from <code>complexInverse</code> called with all imaginary * part equal 0. Because the result is stored in <code>a</code>, the input * array must be of size slices by rows by 2*columns, with only the first * slices by rows by columns elements filled with real data. * * @param a data to transform * @param scale if true then scaling is performed */ public void realInverseFull(double[][][] a, boolean scale) { if (isPowerOfTwo) { int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && useThreads) { xdft3da_subth2(1, 1, a, scale); cdft3db_subth(1, a, scale); rdft3d_sub(1, a); } else { xdft3da_sub2(1, 1, a, scale); cdft3db_sub(1, a, scale); rdft3d_sub(1, a); } fillSymmetric(a); } else { mixedRadixRealInverseFull(a, scale); } }