Difference between revisions of "EigenFFT"

From Eigen
Jump to: navigation, search
(New page: '''Eigen/FFT is a WORK IN PROGRESS''' A new effort was started in May 2009 by Mark Borgerding to port/adapt his [http://sourceforge.net/projects/kissfft kissfft library] to Eigen. The wo...)
 
(added example)
Line 6: Line 6:
 
In particular, help is needed in the area of  
 
In particular, help is needed in the area of  
 
* creating interface functions for Eigen types ( currently accepts POD pointers and std::vectors)
 
* creating interface functions for Eigen types ( currently accepts POD pointers and std::vectors)
* testing and feedback on how to make the  
+
* testing and feedback on how to make the interface better
  
 
The major development milestones are:
 
The major development milestones are:
 
# DONE: one-dimensional FFTs, forward and inverse for float, double,long double
 
# DONE: one-dimensional FFTs, forward and inverse for float, double,long double
 
# DONE: real-only optimization  
 
# DONE: real-only optimization  
# ''TODO'': multi-dimensional FFTs ( more cannibalizing from C version)
+
# '''TODO''': multi-dimensional FFTs ( more cannibalizing from C version)
# DONE: backend for FFTW ( using this requires GPL-compatible application, or the commercial MIT license)
+
# DONE: backend for FFTW ( using this requires GPL-compatible application, or the commercial MIT license for FFTW)
# ''TODO'': backend for intel Math Kernel Library (for closed source applications)
+
# '''TODO''': backend for intel Math Kernel Library (for closed source applications)
 +
 
 +
== Example usage ==
 +
 
 +
#include <unsupported/Eigen/FFT>
 +
 +
...
 +
Eigen::FFT<float> fft;
 +
 +
std::vector<float> timevec = MakeMyData();
 +
std::vector<std::complex<float> > freqvec;
 +
 +
fft.fwd( freqvec,timevec);
 +
// manipulate freqvec
 +
fft.inv( timevec,freqvec);
 +
 +
// stored "plans" get destroyed with fft desctructor
 +
 
  
 
== FFT backend options ==
 
== FFT backend options ==
  
Allowing different backends makes sure everybody can get what they need based on their individual requirements regarding licensing, finances, code size, and execution speed.  The default choice will be the kissfft code since that offers a good balance between licensing ease, size, and speed. This will be easily overridden on system that have the other choices.
+
Allowing different backends makes sure everybody gets what they need based on their individual requirements regarding licensing, finances, code size, and execution speed.  The default choice will be the kissfft code since that offers a good balance between licensing ease, size, and speed. This will be easily overridden on system that have the other choices.
  
 
=== kissfft ===
 
=== kissfft ===
  
The FFT module is derived from the kissfft project, but has undergone and continues to undergo considerable adaptation for use in C++ and Eigen.  The licensing for the derived work has been changed by Mark Borgerding, the kissfft copyright holder, to the Eigen dual LGPL/GPL license.
+
The FFT module is derived from the kissfft project, but has undergone considerable adaptation for use in C++ and Eigen.  The licensing for the derived work has been changed by Mark Borgerding, the kissfft copyright holder, to the Eigen dual LGPL/GPL license.
  
* default choice
+
* default backend
 
* small
 
* small
 
* no external dependencies
 
* no external dependencies
Line 37: Line 54:
 
* enabled by compiling code with
 
* enabled by compiling code with
 
  #include <fftw3.h>
 
  #include <fftw3.h>
before
+
//before
 
  #include <Eigen/FFT>
 
  #include <Eigen/FFT>
 
* requires linkage to FFTW libraries e.g.
 
* requires linkage to FFTW libraries e.g.
Line 43: Line 60:
 
    
 
    
 
=== Intel Math Kernel Library ===
 
=== Intel Math Kernel Library ===
'''TODO'''
+
'''TODO''' This backend has not yet been written.
  
 
* relatively large code size
 
* relatively large code size
Line 50: Line 67:
 
* enabled by compiling code with
 
* enabled by compiling code with
 
  #include <mkl_dfti.h>
 
  #include <mkl_dfti.h>
before
+
// before
 
  #include <Eigen/FFT>
 
  #include <Eigen/FFT>
 
* requires linkage to IMKL libraries
 
* requires linkage to IMKL libraries
  
 
=== Common features ===
 
=== Common features ===
 +
All three backends have a commen set of features
 
* arbitrary FFT sizes
 
* arbitrary FFT sizes
 
* optimization for real-only FFTs (i.e. real x <=> half spectrum X)
 
* optimization for real-only FFTs (i.e. real x <=> half spectrum X)
 
* multi-dimensional FFTs
 
* multi-dimensional FFTs
 
* the concept of a "plan"
 
* the concept of a "plan"

Revision as of 00:53, 17 June 2009

Eigen/FFT is a WORK IN PROGRESS

A new effort was started in May 2009 by Mark Borgerding to port/adapt his kissfft library to Eigen. The work is currently underway under a fork at BitBucket. If all goes well, this will be eventually merged into the mainline development.

Help is welcome. Please send an email on the mailing list or to Mark directly. In particular, help is needed in the area of

  • creating interface functions for Eigen types ( currently accepts POD pointers and std::vectors)
  • testing and feedback on how to make the interface better

The major development milestones are:

  1. DONE: one-dimensional FFTs, forward and inverse for float, double,long double
  2. DONE: real-only optimization
  3. TODO: multi-dimensional FFTs ( more cannibalizing from C version)
  4. DONE: backend for FFTW ( using this requires GPL-compatible application, or the commercial MIT license for FFTW)
  5. TODO: backend for intel Math Kernel Library (for closed source applications)

Example usage

#include <unsupported/Eigen/FFT>

...
Eigen::FFT<float> fft;

std::vector<float> timevec = MakeMyData();
std::vector<std::complex<float> > freqvec;

fft.fwd( freqvec,timevec);
// manipulate freqvec
fft.inv( timevec,freqvec);

// stored "plans" get destroyed with fft desctructor


FFT backend options

Allowing different backends makes sure everybody gets what they need based on their individual requirements regarding licensing, finances, code size, and execution speed. The default choice will be the kissfft code since that offers a good balance between licensing ease, size, and speed. This will be easily overridden on system that have the other choices.

kissfft

The FFT module is derived from the kissfft project, but has undergone considerable adaptation for use in C++ and Eigen. The licensing for the derived work has been changed by Mark Borgerding, the kissfft copyright holder, to the Eigen dual LGPL/GPL license.

  • default backend
  • small
  • no external dependencies
  • reasonably fast
  • Compatible with either choice of Eigen license : GPL or LGPL


FFTW

  • relatively large code size
  • very fast
  • compatible with GPL license (NOT LGPL compatible)
  • enabled by compiling code with
#include <fftw3.h>
//before
#include <Eigen/FFT>
  • requires linkage to FFTW libraries e.g.
 -lfftw3 -lfftw3f -lfftw3l
 

Intel Math Kernel Library

TODO This backend has not yet been written.

  • relatively large code size
  • very fast
  • compatible with LGPL license (NOT GPL compatible)
  • enabled by compiling code with
#include <mkl_dfti.h>
// before
#include <Eigen/FFT>
  • requires linkage to IMKL libraries

Common features

All three backends have a commen set of features

  • arbitrary FFT sizes
  • optimization for real-only FFTs (i.e. real x <=> half spectrum X)
  • multi-dimensional FFTs
  • the concept of a "plan"