1 #ifndef jb_fftw_plan_hpp 2 #define jb_fftw_plan_hpp 14 (FFTW_ESTIMATE | FFTW_PRESERVE_INPUT | FFTW_UNALIGNED);
30 std::size_t in_elements, std::size_t on_elements, std::size_t in_nsamples,
31 std::size_t on_nsamples,
char const* function_name);
54 template <
typename in_timeseries_type,
typename out_timeseries_type>
84 plan tmp(std::move(rhs));
85 std::swap(p_, tmp.
p_);
91 check_constraints checker;
93 traits::destroy_plan(p_);
102 plan& operator=(
plan const&) =
delete;
106 void execute(in_timeseries_type
const& in, out_timeseries_type& out)
const {
115 struct check_constraints;
118 template <
typename itype,
typename otype>
120 template <
typename itype,
typename otype>
122 template <
typename itype,
typename otype>
124 template <
typename itype,
typename otype>
130 traits::execute_plan(p_, in, out);
135 traits::execute_plan(p_, in, out);
140 traits::execute_plan(p_, in, out);
161 return plan(traits::create_plan(nsamples, in, out, flags));
168 return plan(traits::create_plan(nsamples, in, out, flags));
176 traits::create_forward_plan_many(howmany, nsamples, in, out, flags));
184 traits::create_backward_plan_many(howmany, nsamples, in, out, flags));
191 return plan(traits::create_plan_many(howmany, nsamples, in, out, flags));
198 return plan(traits::create_plan_many(howmany, nsamples, in, out, flags));
230 template <
typename in_array_type,
typename out_array_type>
232 in_array_type
const& in, out_array_type& out,
233 int flags = default_plan_flags) {
260 template <
typename in_array_type,
typename out_array_type>
262 in_array_type
const& in, out_array_type& out,
263 int flags = default_plan_flags) {
279 template <
typename in_timeseries_type,
typename out_timeseries_type>
284 using out_value_type =
286 using in_precision_type =
288 using out_precision_type =
291 std::is_same<in_precision_type, out_precision_type>::value,
292 "Mismatched precision_type, both timeseries must have the same" 300 #endif // jb_fftw_plan_hpp plan & operator=(plan &&rhs)
Move assignment.
~plan()
Destructor, cleanup the plan.
fftw_plan_type p_
The raw FFTW plan.
Wrap fftw_* types and operations to treat floating point values generically.
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.
void execute_impl(fftw_complex_type const *in, precision_type *out) const
Execute the plan for arrays of r2c case.
plan< invector, outvector > create_forward_plan_1d(outvector const &out, invector const &in, boost::compute::context &ct, boost::compute::command_queue &q, int batch_size=1)
Create a forward DFT plan.
typename container_type::value_type element_type
Define the type of the elements in the container.
plan< in_array_type, out_array_type > create_forward_plan(in_array_type const &in, out_array_type &out, int flags=default_plan_flags)
Create a plan to compute many DFTs given the input and output arrays.
auto fftw_cast(vector &in) -> decltype(fftw_cast_array(&in[0]))
typename traits::fftw_complex_type fftw_complex_type
void execute_impl(precision_type const *in, fftw_complex_type *out) const
Execute the plan for arrays of r2c case.
void execute_impl(fftw_complex_type const *in, fftw_complex_type *out) const
Execute the plan in the c2c case.
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.
plan()
Create unusable, empty, or null plan.
void execute(in_timeseries_type const &in, out_timeseries_type &out) const
Execute the plan for vectors.
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.
plan(fftw_plan_type p)
Constructor from a raw FFTW plan.
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.
Check the compile-time constraints for a jb::fftw::plan<>
plan(plan &&rhs)
Basic move constructor.
plan< in_array_type, out_array_type > create_backward_plan(in_array_type const &in, out_array_type &out, int flags=default_plan_flags)
Create a plan to compute many inverse DFT given the input and output arrays.
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.
typename jb::detail::array_traits< in_timeseries_type >::element_type in_value_type
type traits
typename jb::extract_value_type< in_value_type >::precision precision_type
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.
std::size_t nsamples(container_type const &a)
Count the elements in the last dimension of a vector-like container.
int constexpr default_plan_flags
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.
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.
std::size_t element_count(container_type const &a)
Count the number of elements for a vector-like container.
void check_plan_inputs(std::size_t in_elements, std::size_t on_elements, std::size_t in_nsamples, std::size_t on_nsamples, char const *function_name)
Helper function to check the inputs to a create_*_plan_*()
typename traits::fftw_plan_type fftw_plan_type
typename traits::std_complex_type std_complex_type
The top-level namespace for the JayBeams library.