Commit 9b9afc01 authored by Davis King's avatar Davis King

Upgraded fft() and ifft() to support 2D matrices.

parent e9ad3351
This diff is collapsed.
......@@ -29,19 +29,19 @@ namespace dlib
/*!
requires
- data contains elements of type std::complex<>
- is_vector(data) == true
- is_power_of_two(data.size()) == true
- is_power_of_two(data.nr()) == true
- is_power_of_two(data.nc()) == true
ensures
- Computes the discrete Fourier transform of the given data vector and
returns it. In particular, we return a matrix D such that:
- Computes the 1 or 2 dimensional discrete Fourier transform of the given data
matrix and returns it. In particular, we return a matrix D such that:
- D.nr() == data.nr()
- D.nc() == data.nc()
- D(0) == the DC term of the Fourier transform.
- starting with D(0), D contains progressively higher frequency components
- D(0,0) == the DC term of the Fourier transform.
- starting with D(0,0), D contains progressively higher frequency components
of the input data.
- ifft(D) == D
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given double precision matrices instead of dlib's default fft
library when given matrix<double> objects instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
this feature.
!*/
......@@ -55,14 +55,71 @@ namespace dlib
/*!
requires
- data contains elements of type std::complex<>
- is_vector(data) == true
- is_power_of_two(data.size()) == true
- is_power_of_two(data.nr()) == true
- is_power_of_two(data.nc()) == true
ensures
- Computes the inverse discrete Fourier transform of the given data vector and
returns it. In particular, we return a matrix D such that:
- Computes the 1 or 2 dimensional inverse discrete Fourier transform of the
given data vector and returns it. In particular, we return a matrix D such
that:
- D.nr() == data.nr()
- D.nc() == data.nc()
- fft(D) == data
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given matrix<double> objects instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
this feature.
!*/
// ----------------------------------------------------------------------------------------
template <
typename T,
long NR,
long NC,
typename MM,
typename L
>
void fft_inplace (
matrix<std::complex<T>,NR,NC,MM,L>& data
);
/*!
requires
- data contains elements of type std::complex<>
- is_power_of_two(data.nr()) == true
- is_power_of_two(data.nc()) == true
ensures
- This function is identical to fft() except that it does the FFT in-place.
That is, after this function executes we will have:
- #data == fft(data)
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given double precision matrices instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
this feature.
!*/
// ----------------------------------------------------------------------------------------
template <
typename T,
long NR,
long NC,
typename MM,
typename L
>
void ifft_inplace (
matrix<std::complex<T>,NR,NC,MM,L>& data
);
/*!
requires
- data contains elements of type std::complex<>
- is_power_of_two(data.nr()) == true
- is_power_of_two(data.nc()) == true
ensures
- This function is identical to ifft() except that it does the inverse FFT
in-place. That is, after this function executes we will have:
- #data == ifft(data)*data.size()
- Note that the output needs to be divided by data.size() to complete the
inverse transformation.
- if DLIB_USE_FFTW is #defined then this function will use the very fast fftw
library when given double precision matrices instead of dlib's default fft
implementation. Note that you must also link to the fftw3 library to use
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment