JayBeams
0.1
Another project to have fun coding.
|
Wrap FFTW3 plan objects. More...
#include <plan.hpp>
Classes | |
struct | check_constraints |
Check the compile-time constraints for a jb::fftw::plan<> More... | |
Public Types | |
using | in_value_type = typename jb::detail::array_traits< in_timeseries_type >::element_type |
type traits More... | |
using | precision_type = typename jb::extract_value_type< in_value_type >::precision |
using | traits = ::jb::fftw::traits< precision_type > |
using | std_complex_type = typename traits::std_complex_type |
using | fftw_complex_type = typename traits::fftw_complex_type |
using | fftw_plan_type = typename traits::fftw_plan_type |
Public Member Functions | |
plan () | |
Create unusable, empty, or null plan. More... | |
plan (plan &&rhs) | |
Basic move constructor. More... | |
plan & | operator= (plan &&rhs) |
Move assignment. More... | |
~plan () | |
Destructor, cleanup the plan. More... | |
void | execute (in_timeseries_type const &in, out_timeseries_type &out) const |
Execute the plan for vectors. More... | |
Prevent copy construction and assignment | |
plan (plan const &)=delete | |
plan & | operator= (plan const &)=delete |
Private Member Functions | |
void | execute_impl (fftw_complex_type const *in, fftw_complex_type *out) const |
Execute the plan in the c2c case. More... | |
void | execute_impl (precision_type const *in, fftw_complex_type *out) const |
Execute the plan for arrays of r2c case. More... | |
void | execute_impl (fftw_complex_type const *in, precision_type *out) const |
Execute the plan for arrays of r2c case. More... | |
plan (fftw_plan_type p) | |
Constructor from a raw FFTW plan. More... | |
Static Private Member Functions | |
static plan | create_forward_impl (std::size_t nsamples, fftw_complex_type const *in, fftw_complex_type *out, int flags) |
Create the direct plan for vectors in the c2c case. More... | |
static plan | create_backward_impl (std::size_t nsamples, fftw_complex_type const *in, fftw_complex_type *out, int flags) |
Create the inverse plan for vectors in the c2c case. More... | |
static plan | create_forward_impl (std::size_t nsamples, precision_type const *in, fftw_complex_type *out, int flags) |
Create the plan for vectors in the r2c case. More... | |
static plan | create_backward_impl (std::size_t nsamples, fftw_complex_type const *in, precision_type *out, int flags) |
Create the plan for vectors in the c2r case. More... | |
static plan | create_forward_many_impl (int howmany, std::size_t nsamples, fftw_complex_type const *in, fftw_complex_type *out, int flags) |
Create the direct plan for arrays in the c2c case. More... | |
static plan | create_backward_many_impl (int howmany, std::size_t nsamples, fftw_complex_type const *in, fftw_complex_type *out, int flags) |
Create the inverse plan for arrays in the c2c case. More... | |
static plan | create_forward_many_impl (int howmany, std::size_t nsamples, precision_type const *in, fftw_complex_type *out, int flags) |
Create the batched plan for arrays in the r2c case. More... | |
static plan | create_backward_many_impl (int howmany, std::size_t nsamples, fftw_complex_type const *in, precision_type *out, int flags) |
Create the batched plan for arrays in the c2r case. More... | |
Private Attributes | |
fftw_plan_type | p_ |
The raw FFTW plan. More... | |
Friends | |
template<typename itype , typename otype > | |
plan< itype, otype > | create_forward_plan (itype const &, otype &, int) |
template<typename itype , typename otype > | |
plan< itype, otype > | create_backward_plan (itype const &, otype &, int) |
template<typename itype , typename otype > | |
plan< itype, otype > | create_forward_plan_1d (itype const &, otype &, int) |
template<typename itype , typename otype > | |
plan< itype, otype > | create_backward_plan_1d (itype const &, otype &, int) |
Wrap FFTW3 plan objects.
The FFTW3 optimizes execution by pre-computing coefficients and execution plans for a DFT based on the original types, size and alingment of the data. In C++, we prefer the type system to remember details like this instead of getting an error message when we use the wrong types (or a crash).
In addition, the FFTW3 library uses different names for the types that have single (fftwf_*), double (fftw_*) or quad-precision (fftwl_*). In C++ we prefer to hide such details in generics.
Finally, these plans must be destroyed to release resources. FFTW3, being a C library, requires wrappers to automate the destruction of these objects.
in_timeseries_type | the type of the input timeseries |
out_timeseries_type | the type of the output timeseries |
using jb::fftw::plan< in_timeseries_type, out_timeseries_type >::fftw_complex_type = typename traits::fftw_complex_type |
using jb::fftw::plan< in_timeseries_type, out_timeseries_type >::fftw_plan_type = typename traits::fftw_plan_type |
using jb::fftw::plan< in_timeseries_type, out_timeseries_type >::in_value_type = typename jb::detail::array_traits<in_timeseries_type>::element_type |
using jb::fftw::plan< in_timeseries_type, out_timeseries_type >::precision_type = typename jb::extract_value_type<in_value_type>::precision |
using jb::fftw::plan< in_timeseries_type, out_timeseries_type >::std_complex_type = typename traits::std_complex_type |
using jb::fftw::plan< in_timeseries_type, out_timeseries_type >::traits = ::jb::fftw::traits<precision_type> |
|
inline |
|
inline |
|
inline |
|
delete |
|
inlineexplicitprivate |
|
inlinestaticprivate |
Create the inverse plan for vectors in the c2c case.
Definition at line 151 of file plan.hpp.
Referenced by jb::fftw::create_backward_plan().
|
inlinestaticprivate |
|
inlinestaticprivate |
Create the inverse plan for arrays in the c2c case.
Definition at line 180 of file plan.hpp.
Referenced by jb::fftw::create_backward_plan().
|
inlinestaticprivate |
|
inlinestaticprivate |
Create the direct plan for vectors in the c2c case.
Definition at line 144 of file plan.hpp.
Referenced by jb::fftw::create_forward_plan().
|
inlinestaticprivate |
|
inlinestaticprivate |
Create the direct plan for arrays in the c2c case.
Definition at line 172 of file plan.hpp.
Referenced by jb::fftw::create_forward_plan().
|
inlinestaticprivate |
|
inline |
Execute the plan for vectors.
Definition at line 106 of file plan.hpp.
Referenced by jb::fftw::time_delay_estimator< timeseries_t, vector >::estimate_delay(), and jb::fftw::time_delay_estimator_many< array_t >::estimate_delay().
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inline |
|
delete |
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
The raw FFTW plan.
Definition at line 213 of file plan.hpp.
Referenced by jb::fftw::plan< timeseries_type, frequency_timeseries_type >::operator=().