mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-27 21:20:27 -04:00
Added the method kissfft::assign().
This commit is contained in:
parent
6e0d8bbcd2
commit
6a8798c453
25
kissfft.hh
25
kissfft.hh
@ -1,6 +1,7 @@
|
|||||||
#ifndef KISSFFT_CLASS_HH
|
#ifndef KISSFFT_CLASS_HH
|
||||||
#define KISSFFT_CLASS_HH
|
#define KISSFFT_CLASS_HH
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
@ -44,6 +45,30 @@ class kissfft
|
|||||||
}while(n>1);
|
}while(n>1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Changes the FFT-length and/or the transform direction.
|
||||||
|
///
|
||||||
|
/// @post The @c kissfft object will be in the same state as if it
|
||||||
|
/// had been newly constructed with the passed arguments.
|
||||||
|
/// However, the implementation may be faster than constructing a
|
||||||
|
/// new fft object.
|
||||||
|
void assign( std::size_t nfft,
|
||||||
|
bool inverse )
|
||||||
|
{
|
||||||
|
if ( nfft != _nfft )
|
||||||
|
{
|
||||||
|
kissfft tmp( nfft, inverse ); // O(n) time.
|
||||||
|
std::swap( tmp, *this ); // this is O(1) in C++11, O(n) otherwise.
|
||||||
|
}
|
||||||
|
else if ( inverse != _inverse )
|
||||||
|
{
|
||||||
|
// conjugate the twiddle factors.
|
||||||
|
for ( typename std::vector<cpx_type>::iterator it = _twiddles.begin();
|
||||||
|
it != _twiddles.end(); ++it )
|
||||||
|
it->imag( -it->imag() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Calculates the complex Discrete Fourier Transform.
|
/// Calculates the complex Discrete Fourier Transform.
|
||||||
///
|
///
|
||||||
/// The size of the passed arrays must be passed in the constructor.
|
/// The size of the passed arrays must be passed in the constructor.
|
||||||
|
Loading…
Reference in New Issue
Block a user