/** * Returns new complex matrix which is the discrete Fourier transform (DFT) * of this matrix. * * @return the discrete Fourier transform (DFT) of this matrix. */ public DenseDComplexMatrix1D getFft() { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); final double[] elems; if (isNoView == true) { elems = elements; } else { elems = (double[]) this.copy().elements(); } DenseDComplexMatrix1D c = new DenseDComplexMatrix1D(size); final double[] elementsC = (c).elements(); System.arraycopy(elems, 0, elementsC, 0, size); if (fft == null) { fft = new DoubleFFT_1D(size); } fft.realForwardFull(elementsC); ConcurrencyUtils.setNumberOfThreads(oldNthreads); return c; }
/** * Returns new complex matrix which is the inverse of the discrete Fourier * (IDFT) transform of this matrix. * * @return the inverse of the discrete Fourier transform (IDFT) of this * matrix. */ public DenseDComplexMatrix1D getIfft(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); final double[] elems; if (isNoView == true) { elems = elements; } else { elems = (double[]) this.copy().elements(); } DenseDComplexMatrix1D c = new DenseDComplexMatrix1D(size); final double[] elementsC = (c).elements(); System.arraycopy(elems, 0, elementsC, 0, size); if (fft == null) { fft = new DoubleFFT_1D(size); } fft.realInverseFull(elementsC, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads); return c; }
/** * Returns new complex matrix which is the discrete Fourier transform (DFT) * of this matrix. * * @return the discrete Fourier transform (DFT) of this matrix. */ public DenseDComplexMatrix1D getFft() { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); final double[] elems; if (isNoView == true) { elems = elements; } else { elems = (double[]) this.copy().elements(); } DenseDComplexMatrix1D c = new DenseDComplexMatrix1D(size); final double[] elementsC = (c).elements(); System.arraycopy(elems, 0, elementsC, 0, size); if (fft == null) { fft = new DoubleFFT_1D(size); } fft.realForwardFull(elementsC); ConcurrencyUtils.setNumberOfThreads(oldNthreads); return c; }
/** * Returns new complex matrix which is the inverse of the discrete Fourier * (IDFT) transform of this matrix. * * @return the inverse of the discrete Fourier transform (IDFT) of this * matrix. */ public DenseDComplexMatrix1D getIfft(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); final double[] elems; if (isNoView == true) { elems = elements; } else { elems = (double[]) this.copy().elements(); } DenseDComplexMatrix1D c = new DenseDComplexMatrix1D(size); final double[] elementsC = (c).elements(); System.arraycopy(elems, 0, elementsC, 0, size); if (fft == null) { fft = new DoubleFFT_1D(size); } fft.realInverseFull(elementsC, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads); return c; }
/** * Computes the discrete Hartley transform (DHT) of this matrix. * */ public void dht() { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dht == null) { dht = new DoubleDHT_1D(size); } if (isNoView) { dht.forward(elements); } else { DoubleMatrix1D copy = this.copy(); dht.forward((double[]) copy.elements()); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the discrete cosine transform (DCT-II) of this matrix. * * @param scale * if true then scaling is performed */ public void dct(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dct == null) { dct = new DoubleDCT_1D(size); } if (isNoView) { dct.forward(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dct.forward((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the discrete Hartley transform (DHT) of this matrix. * */ public void dht() { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dht == null) { dht = new DoubleDHT_1D(size); } if (isNoView) { dht.forward(elements); } else { DoubleMatrix1D copy = this.copy(); dht.forward((double[]) copy.elements()); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of discrete sine transform (DST-III) of this matrix. * * @param scale * if true then scaling is performed */ public void idst(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dst == null) { dst = new DoubleDST_1D(size); } if (isNoView) { dst.inverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dst.inverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the discrete sine transform (DST-II) of this matrix. * * @param scale * if true then scaling is performed */ public void dst(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dst == null) { dst = new DoubleDST_1D(size); } if (isNoView) { dst.forward(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dst.forward((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of the discrete cosine transform (DCT-III) of this * matrix. * * @param scale * if true then scaling is performed */ public void idct(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dct == null) { dct = new DoubleDCT_1D(size); } if (isNoView) { dct.inverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dct.inverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of the discrete Hartley transform (IDHT) of this * matrix. * * @param scale * if true then scaling is performed */ public void idht(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dht == null) { dht = new DoubleDHT_1D(size); } if (isNoView) { dht.inverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dht.inverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the discrete sine transform (DST-II) of this matrix. * * @param scale * if true then scaling is performed */ public void dst(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dst == null) { dst = new DoubleDST_1D(size); } if (isNoView) { dst.forward(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dst.forward((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of discrete sine transform (DST-III) of this matrix. * * @param scale * if true then scaling is performed */ public void idst(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dst == null) { dst = new DoubleDST_1D(size); } if (isNoView) { dst.inverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dst.inverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of the discrete Hartley transform (IDHT) of this * matrix. * * @param scale * if true then scaling is performed */ public void idht(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dht == null) { dht = new DoubleDHT_1D(size); } if (isNoView) { dht.inverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dht.inverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the discrete cosine transform (DCT-II) of this matrix. * * @param scale * if true then scaling is performed */ public void dct(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dct == null) { dct = new DoubleDCT_1D(size); } if (isNoView) { dct.forward(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dct.forward((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of the discrete cosine transform (DCT-III) of this * matrix. * * @param scale * if true then scaling is performed */ public void idct(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dct == null) { dct = new DoubleDCT_1D(size); } if (isNoView) { dct.inverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); dct.inverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
fft.realForward(elements); } else { DoubleMatrix1D copy = this.copy(); fft.realForward((double[]) copy.elements()); this.assign((double[]) copy.elements());
/** * Computes the inverse of the discrete Fourier transform (DFT) of this * matrix. The physical layout of the input data has to be as follows: * * <pre> * this[2*k] = Re[k], 0<=k<size/2 * this[2*k+1] = Im[k], 0<k<size/2 * this[1] = Re[size/2] * </pre> * * This method computes only half of the elements of the real transform. The * other half satisfies the symmetry condition. If you want the full real * inverse transform, use <code>getIfft</code>. * */ public void ifft(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft == null) { fft = new DoubleFFT_1D(size); } if (isNoView) { fft.realInverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); fft.realInverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
/** * Computes the inverse of the discrete Fourier transform (DFT) of this * matrix. The physical layout of the input data has to be as follows: * * <pre> * this[2*k] = Re[k], 0<=k<size/2 * this[2*k+1] = Im[k], 0<k<size/2 * this[1] = Re[size/2] * </pre> * * This method computes only half of the elements of the real transform. The * other half satisfies the symmetry condition. If you want the full real * inverse transform, use <code>getIfft</code>. * */ public void ifft(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (fft == null) { fft = new DoubleFFT_1D(size); } if (isNoView) { fft.realInverse(elements, scale); } else { DoubleMatrix1D copy = this.copy(); fft.realInverse((double[]) copy.elements(), scale); this.assign((double[]) copy.elements()); } ConcurrencyUtils.setNumberOfThreads(oldNthreads); }
fft.realForward(elements); } else { DoubleMatrix1D copy = this.copy(); fft.realForward((double[]) copy.elements()); this.assign((double[]) copy.elements());