SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces
FFT.hpp File Reference

Provides some FFT algorithms. More...

#include <iostream>
#include <complex>
#include <cmath>
#include <iterator>
#include <algorithm>
#include "Array.hpp"
#include "macros.hpp"
#include "Matrix.hpp"
#include "Vector.hpp"
#include "statistics.hpp"
#include "FFTPACK.hpp"
#include <vector>
#include <fftw3.h>
Include dependency graph for FFT.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 slip
 This namespace corresponds to the kernel of the Simple Library on Image Processing (SLIP). That is to say that it contains the data structures and the algorithms needed by these data strucutres.
 

Functions

FFT Tools Functions
unsigned int slip::bitReverse (unsigned int x, const int log2n)
 bitReverse function used in the Cooley-Tukey FFT algorithm More...
 
unsigned int slip::log2 (unsigned int x)
 Calculates the log2 of an integer. More...
 
template<class ForwardIterator >
void slip::fftshift (ForwardIterator first, ForwardIterator last)
 Performs a shift of a container, for use with the fft and ifft functions, in order to move the frequency 0 to the center of the container. More...
 
template<class ForwardIterator2D >
void slip::fftshift2d (ForwardIterator2D upper_left, ForwardIterator2D bottom_right)
 Performs a shift of a 2d container, for use with the fft2d and ifft2d functions, in order to move the frequency 0 to the center of the container. More...
 
template<class ForwardIterator3D >
void slip::fftshift3d (ForwardIterator3D front_upper_left, ForwardIterator3D back_bottom_right)
 Performs a shift of a 2d container, for use with the fft2d and ifft2d functions, in order to move the frequency 0 to the center of the container. More...
 
template<class ForwardIterator4D >
void slip::fftshift4d (ForwardIterator4D first_front_upper_left, ForwardIterator4D last_back_bottom_right)
 Performs a shift of a 4d container, for use with the fft4d and ifft4d functions, in order to move the frequency 0 to the center of the container. More...
 
FFT Radix2 (Cooley-Tukey) algorithms.
template<class InputIter_T , class Iter_T >
void slip::radix2_fft (InputIter_T a, Iter_T b, const int log2n)
 Computes the Cooley-Tukey (radix2) fft of a container. More...
 
template<class InputIter_T , class Iter_T >
void slip::radix2_ifft (InputIter_T a, Iter_T b, const int log2n)
 Computes the inverse Cooley-Tukey (radix2) fft of a container. More...
 
template<class InputIter_T , class Iter_T >
void slip::real_radix2_fft (InputIter_T a, Iter_T b, const int log2n)
 Computes the Cooley-Tukey (radix2) real_fft of a container. More...
 
template<typename InputIterator1d , typename OuputIterator1d >
void slip::radix2_fft1d2d (InputIterator1d begin1, OuputIterator1d begin2, std::size_t nb_lig, std::size_t nb_col)
 Computes the radix 2 fft2d of a container with 1d iterator (compatible with simple pointers). More...
 
template<typename InputIterator1d , typename OuputIterator1d >
void slip::radix2_ifft1d2d (InputIterator1d begin1, OuputIterator1d begin2, std::size_t nb_lig, std::size_t nb_col)
 Computes the inverse radix 2 fft2d of a container with 1d iterators (compatible with simple pointers). More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::radix2_fft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the radix2 (Cooley-Tukey) fft2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::radix2_ifft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the radix2 ifft2d of a container with 2d iterators. More...
 
template<typename Matrix1 , typename Matrix2 >
void slip::radix2_fft2d (Matrix1 &datain, Matrix2 &dataout)
 Computes the radix2 fft2d of a container. More...
 
template<typename Matrix1 , typename Matrix2 >
void slip::radix2_ifft2d (Matrix1 &datain, Matrix2 &dataout)
 Computes the radix2 fft2d of a container. More...
 
FFT Split-Radix algorithms (from FFTPACK.hpp).
template<class InputIter , class OutputIter >
void slip::real_split_radix_fft (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the real split radix fft of a container (from FFTPACK.hpp). More...
 
template<class InputIter , class OutputIter >
void slip::complex_split_radix_fft (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the complex split radix fft of a container (from FFTPACK.hpp). More...
 
template<class InputIter , class OutputIter >
void slip::split_radix_ifft (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the split radix fft backward of a container (from FFTPACK.hpp). More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::real_split_radix_fft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the real split-radix fft2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::complex_split_radix_fft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the complex split-radix fft2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::split_radix_ifft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the split-radix ifft2d of a container with 2d iterators. More...
 
template<typename InputMatrix , typename OutputMatrix >
void slip::real_split_radix_fft2d (InputMatrix &datain, OutputMatrix &dataout)
 Computes the real split-radix fft2d of a container. More...
 
template<typename InputMatrix , typename OutputMatrix >
void slip::split_radix_ifft2d (InputMatrix &datain, OutputMatrix &dataout)
 Computes the split-radix ifft2d of a container. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::real_split_radix_fft3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the real split-radix fft3d of a container with 3d iterators. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::split_radix_ifft3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the split-radix ifft3d of a container with 3d iterators. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::complex_split_radix_fft3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the complex split-radix fft3d of a container with 3d iterators. More...
 
template<typename InputMatrix3d , typename OutputMatrix3d >
void slip::complex_split_radix_fft3d (InputMatrix3d &datain, OutputMatrix3d &dataout)
 Computes the complex split-radix fft3d of a container 3d. More...
 
template<typename InputMatrix3d , typename OutputMatrix3d >
void slip::real_split_radix_fft3d (InputMatrix3d &datain, OutputMatrix3d &dataout)
 Computes the real split-radix fft3d of a container 3d. More...
 
template<typename InputMatrix3d , typename OutputMatrix3d >
void slip::split_radix_ifft3d (InputMatrix3d &datain, OutputMatrix3d &dataout)
 Computes the split-radix ifft3d of a container 3d. More...
 
template<class InputIter , class OutputIter >
void slip::split_radix_idct (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the split radix Discrete Cosinus Transform III (i.e. idct) of a container (from FFTPACK.hpp). More...
 
template<class InputIter , class OutputIter >
void slip::split_radix_dct (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the split radix Discrete Cosinus Transform II of a container (from FFTPACK.hpp). More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::real_split_radix_fft4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the real split-radix fft4d of a container with 4d iterators. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::complex_split_radix_fft4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the complex split-radix fft4d of a container with 4d iterators. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::split_radix_ifft4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the split-radix ifft4d of a container with 4d iterators. More...
 
template<typename InputMatrix4d , typename OutputMatrix4d >
void slip::real_split_radix_fft4d (const InputMatrix4d &datain, OutputMatrix4d &dataout)
 Computes the real split-radix fft4d of a container 4d. More...
 
template<typename InputMatrix4d , typename OutputMatrix4d >
void slip::complex_split_radix_fft4d (const InputMatrix4d &datain, OutputMatrix4d &dataout)
 Computes the complex split-radix fft4d of a container 4d. More...
 
template<typename InputMatrix4d , typename OutputMatrix4d >
void slip::split_radix_ifft4d (const InputMatrix4d &datain, OutputMatrix4d &dataout)
 Computes the split-radix ifft4d of a container 4d. More...
 
fftw algorithms (from fftw3.h).
template<class ForwardIterator1 , class ForwardIterator2 >
void slip::fftduplicate (ForwardIterator1 begin1, ForwardIterator2 begin2, ForwardIterator2 end2)
 Calculates the conjugates of the begin std::complex elements of a first container. Writes them at the end of a second container. This function is used to calculate the negative frequencies after a real fftw. More...
 
template<class ForwardIterator2D >
void slip::fftduplicate2d (ForwardIterator2D upper_left, ForwardIterator2D bottom_right)
 Performs a duplicate of a 2D container, for use with the fft2d and ifft2d functions, in order to calculate the negative frequencies with the real fftw2d. More...
 
template<class InputIter , class OutputIter >
void slip::real_fftw (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the real fftw of a container (from fftw3.h). More...
 
template<class InputIter , class OutputIter >
void slip::complex_fftw (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 complex fftw of a container (from fftw3.h). More...
 
template<class InputIter , class OutputIter >
void slip::ifftw (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the fftw backward of a container (from fftw3.h). More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::real_fftw2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the real fftw2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::complex_fftw2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the complex fftw2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::ifftw2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the ifftw2d of a container with 2d iterators. More...
 
template<typename InputMatrix , typename OutputMatrix >
void slip::real_fftw2d (InputMatrix &datain, OutputMatrix &dataout)
 Computes the real fftw2d of a container. More...
 
template<typename InputMatrix , typename OutputMatrix >
void slip::ifftw2d (InputMatrix &datain, OutputMatrix &dataout)
 Computes the ifftw2d of a container. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::real_fftw3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the real fftw3d of a container with 3d iterators. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::complex_fftw3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the complex fftw3d of a container with 3d iterators. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::complex_fft3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the complex fft3d of a container with 3d iterators. More...
 
template<typename Volume1 , typename Volume2 >
void slip::complex_fft3d (Volume1 &datain, Volume2 &dataout)
 Computes the complex fft3d of a container. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::ifftw3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the ifftw3d of a container with 3d iterators. More...
 
template<typename InputMatrix3d , typename OutputMatrix3d >
void slip::real_fftw3d (InputMatrix3d &datain, OutputMatrix3d &dataout)
 Computes the real fftw3d of a container 3d. More...
 
template<typename InputMatrix3d , typename OutputMatrix3d >
void slip::complex_fftw3d (InputMatrix3d &datain, OutputMatrix3d &dataout)
 Computes the complex fftw3d of a container 3d. More...
 
template<typename InputMatrix3d , typename OutputMatrix3d >
void slip::ifftw3d (InputMatrix3d &datain, OutputMatrix3d &dataout)
 Computes the ifftw3d of a container 3d. More...
 
template<class InputIter , class OutputIter >
void slip::fftw_dct (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the Discrete Cosinus Transform II (forward) of a container (from fftw). More...
 
template<class InputIter , class OutputIter >
void slip::fftw_idct (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the Discrete Cosinus Transform III (backward) of a container (from fftw). More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::real_fftw4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the real fftw4d of a container with 4d iterators. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::complex_fftw4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the complex fftw4d of a container with 4d iterators. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::ifftw4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the ifftw4d of a container with 4d iterators. More...
 
template<typename InputMatrix4d , typename OutputMatrix4d >
void slip::real_fftw4d (const InputMatrix4d &datain, OutputMatrix4d &dataout)
 Computes the real fftw4d of a container 4d. More...
 
template<typename InputMatrix4d , typename OutputMatrix4d >
void slip::complex_fftw4d (const InputMatrix4d &datain, OutputMatrix4d &dataout)
 Computes the complex fftw4d of a container 4d. More...
 
template<typename InputMatrix4d , typename OutputMatrix4d >
void slip::ifftw4d (const InputMatrix4d &datain, OutputMatrix4d &dataout)
 Computes the ifftw4d of a container 4d. More...
 
FFT Generic Algorithms
template<class InputIter , class OutputIter >
void slip::real_fft (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the real fft of a container. More...
 
template<class InputIter , class OutputIter >
void slip::complex_fft (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the complex fft of a container. More...
 
template<class InputIter , class OutputIter >
void slip::ifft (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the inverse fft of a container. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::real_fft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the real fft2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::complex_fft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the complex fft2d of a container with 2d iterators. More...
 
template<typename InputBidirectionalIterator2d , typename OutputBidirectionalIterator2d >
void slip::ifft2d (InputBidirectionalIterator2d in_upper_left, InputBidirectionalIterator2d in_bottom_right, OutputBidirectionalIterator2d out_upper_left)
 Computes the ifft2d of a container with 2d iterators. More...
 
template<typename Matrix1 , typename Matrix2 >
void slip::real_fft2d (Matrix1 &datain, Matrix2 &dataout)
 Computes the real fft2d of a container. More...
 
template<typename Matrix1 , typename Matrix2 >
void slip::complex_fft2d (Matrix1 &datain, Matrix2 &dataout)
 Computes the complex fft2d of a container. More...
 
template<typename Matrix1 , typename Matrix2 >
void slip::ifft2d (Matrix1 &datain, Matrix2 &dataout)
 Computes the fft2d of a container. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::real_fft3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the real fft3d of a container with 3d iterators. More...
 
template<typename InputBidirectionalIterator3d , typename OutputBidirectionalIterator3d >
void slip::ifft3d (InputBidirectionalIterator3d in_front_upper_left, InputBidirectionalIterator3d in_back_bottom_right, OutputBidirectionalIterator3d out_front_upper_left)
 Computes the ifft3d of a container with 3d iterators. More...
 
template<typename Volume1 , typename Volume2 >
void slip::real_fft3d (Volume1 &datain, Volume2 &dataout)
 Computes the real fft3d of a container. More...
 
template<typename Volume1 , typename Volume2 >
void slip::ifft3d (Volume1 &datain, Volume2 &dataout)
 Computes the fft3d of a container. More...
 
template<class InputIter , class OutputIter >
void slip::dct (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the Discrete Cosinus Transform II (forward) of a container. More...
 
template<class InputIter , class OutputIter >
void slip::idct (InputIter in_begin, InputIter in_end, OutputIter out_begin)
 Computes the Discrete Cosinus Transform III (backward) of a container. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::real_fft4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the real fft4d of a container with 4d iterators. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::complex_fft4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the complex fft4d of a container with 4d iterators. More...
 
template<typename InputBidirectionalIterator4d , typename OutputBidirectionalIterator4d >
void slip::ifft4d (InputBidirectionalIterator4d in_first_front_upper_left, InputBidirectionalIterator4d in_last_back_bottom_right, OutputBidirectionalIterator4d out_first_front_upper_left)
 Computes the ifft4d of a container with 4d iterators. More...
 
template<typename HyperVolume1 , typename HyperVolume2 >
void slip::real_fft4d (const HyperVolume1 &datain, HyperVolume2 &dataout)
 Computes the real fft4d of a container. More...
 
template<typename HyperVolume1 , typename HyperVolume2 >
void slip::complex_fft4d (const HyperVolume1 &datain, HyperVolume2 &dataout)
 Computes the complex fft4d of a container. More...
 
template<typename HyperVolume1 , typename HyperVolume2 >
void slip::ifft4d (const HyperVolume1 &datain, HyperVolume2 &dataout)
 Computes the fft4d of a container. More...
 

Detailed Description

Provides some FFT algorithms.

Since
1.0.0

Definition in file FFT.hpp.