1 #ifndef jb_fftw_time_delay_estimator_hpp 2 #define jb_fftw_time_delay_estimator_hpp 15 typename timeseries_t,
66 if (a.size() != b.size()) {
67 throw std::invalid_argument(
"size mismatch in time_delay_estimator ctor");
72 std::pair<bool, precision_type>
77 if (a.size() !=
tmpa_.size() or b.size() !=
tmpa_.size()) {
78 throw std::invalid_argument(
79 "size mismatch in time_delay_estimator<>::estimate_delay()");
85 for (std::size_t i = 0; i !=
tmpa_.size(); ++i) {
91 precision_type max = std::numeric_limits<precision_type>::min();
92 std::size_t argmax = 0;
93 for (std::size_t i = 0; i !=
out_.size(); ++i) {
102 if (max <= std::numeric_limits<precision_type>::epsilon()) {
116 return FFTW_MEASURE | FFTW_UNALIGNED;
131 #endif // jb_fftw_time_delay_estimator_hpp std::pair< bool, precision_type > estimate_delay(timeseries_type &a, timeseries_type &b)
Compute the time-delay estimate between two timeseries.
std::vector< T, jb::fftw::allocator< T > > aligned_vector
Alias std::vector with properly allocated storage for FFTW3.
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.
time_delay_estimator(timeseries_type &a, timeseries_type &b)
Constructs a time delay estimator using.
jb::extract_value_type< value_type >::precision precision_type
Extract T out of std::complex<T>, otherwise simply T.
vector< std::complex< precision_type > > frequency_timeseries_type
The type used to store the DFT of the input timeseries.
void execute(in_timeseries_type const &in, out_timeseries_type &out) const
Execute the plan for vectors.
A simple time delay estimator based on cross-correlation.
jb::fftw::plan< timeseries_type, frequency_timeseries_type > dplan
The execution plan to apply the (forward) DFT.
timeseries_t timeseries_type
The input timeseries type.
static int planning_flags()
Determine the correct FFTW planning flags given the inputs.
frequency_timeseries_type tmpa_
vector< precision_type > output_timeseries_type
The type used to stored the inverse of the DFT.
jb::fftw::plan< frequency_timeseries_type, output_timeseries_type > iplan
The execution plan to apply the inverse (aka backward) DFT.
output_timeseries_type out_
timeseries_type::value_type value_type
The values stored in the input timeseries.
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.
frequency_timeseries_type tmpb_
Determine if a timeseries type guarantees alignment suitable for SIMD optimizations.
The top-level namespace for the JayBeams library.