Chooses the optimal FFT length for Filterbank and/or Convolution. More...

#include <OptimalFFT.h>

Inheritance diagram for dsp::OptimalFFT:
Reference::Able Reference::HeapTracked dsp::OptimalFilterbank

Public Member Functions

void set_simultaneous (bool flag)
 Set true when convolution is performed during filterbank synthesis.
 
unsigned get_nfft (unsigned nfilt) const
 
virtual void set_nchan (unsigned nchan)
 Set the number of channels into which the data will be divided.
 
virtual double compute_cost (unsigned nfft, unsigned nfilt) const
 Return the time required to execute in microseconds.
 
virtual std::string get_library (unsigned nfft)
 Get the name of the FFT library to use for the given FFT length.
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Static Public Attributes

static bool verbose = false
 

Protected Member Functions

virtual FTransform::Benchnew_bench () const
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

Reference::To< FTransform::Benchbench
 
unsigned nchan
 
bool simultaneous
 

Additional Inherited Members

- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 

Detailed Description

Chooses the optimal FFT length for Filterbank and/or Convolution.

Member Function Documentation

◆ get_nfft()

unsigned dsp::OptimalFFT::get_nfft ( unsigned  nfilt) const

This method computes the optimal FFT length to use when performing multiple FFTs on a long time series. If FFT cost measurements are not available, this function assumes that the FFT is an O(NlogN) operation.

GIVEN: nchan - number of channels into which data will be divided nfilt - filter length (points discarded from each FFT in each channel)

RETURNS: The return value is the optimal FFT length, nfft


Where ngood = nfft - nfilt, the following ideas are held:

1) performance is better if ngood is a large fraction of nfft, 2) FFT performance is much better with smaller nfft.

The timescale for one FFT is proportional to NlogN, or:

           t = nfft * log(nfft)

The number of FFTs performed on a segment of M time samples is:

          Nf = M / (nfft - nfilt)

The total time spent on FFTs is then:

           T = t * Nf = nfft * log(nfft) * M/(nfft-nfilt)

Where M may be considered constant, and nfilt is given, this function aims to minimize:

     T(nfft) = nfft * log(nfft) / (nfft-nfilt)

The documentation for this class was generated from the following files:

Generated using doxygen 1.8.17