1 #ifndef jb_fftw_time_delay_estimator_many_hpp 2 #define jb_fftw_time_delay_estimator_many_hpp 24 template <
typename array_t>
94 throw std::invalid_argument(
"size mismatch in time_delay_estimator ctor");
115 throw std::invalid_argument(
116 "shape mismatch in time_delay_estimator<>::estimate_delay()");
126 ++i, ++it_tmpa, ++it_tmpb) {
127 *it_tmpa = std::conj(*it_tmpa) * (*it_tmpb);
136 precision_type max_val = std::numeric_limits<precision_type>::min();
137 std::size_t tde_val = 0;
138 for (std::size_t j = 0; j !=
nsamples_; ++j, ++it_out) {
139 if (max_val < *it_out) {
144 if (sum2[i] < std::numeric_limits<precision_type>::epsilon()) {
147 confidence[i] = max_val / sum2[i];
149 estimated_delay[i] = tde_val;
159 return FFTW_MEASURE | FFTW_PRESERVE_INPUT;
161 return FFTW_MEASURE | FFTW_PRESERVE_INPUT | FFTW_UNALIGNED;
186 #endif // jb_fftw_time_delay_estimator_many_hpp typename container_type::value_type element_type
Define the type of the elements in the container.
typename jb::extract_value_type< element_type >::precision precision_type
Extract T out of std::complex<T>, otherwise simply T.
output_array_type out_
out_ : timeseries to store the result of inverse FFT
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.
A time-delay estimator (TDE) is an algorithm to compare two families of timeseries and return the est...
void execute(in_timeseries_type const &in, out_timeseries_type &out) const
Execute the plan for vectors.
std::size_t nsamples_
nsamples : num samples of timeseries
std::size_t array_shape(container_type const &a)
Return the shape of the container in a form suitable for construction of a vector-like container...
time_delay_estimator_many(array_type &a, array_type &b)
Constructs a time delay estimator using a and b as prototypes for the arguments.
typename jb::detail::array_traits< array_type >::element_type element_type
The values stored in the input timeseries.
frequency_array_type tmpa_
tmpa_ : timeseries to store the result of FFT(a)
A time delay estimator based on cross-correlation.
void estimate_delay(confidence_type &confidence, estimated_delay_type &estimated_delay, array_type &a, array_type &b, sum2_type const &sum2)
Compute the time-delay estimate between two timeseries a and b.
Alias array_type based on the container_type shape to store value_type.
iplan tmpa2out_
tmpa2out : fftw plan to execute inverse FFT of a timeseries
typename jb::detail::aligned_container< precision_type, array_type >::array_type output_array_type
The type used to store the inverse of the DFT.
frequency_array_type tmpb_
tmpb_ : timeseries to store the result of FFT(b)
std::complex< precision_type > complex_type
complex_type use by FFT plans frequency array type
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.
typename jb::detail::aligned_container< complex_type, array_type >::array_type frequency_array_type
The type used to store the DFT of the input timeseries.
array_t array_type
The input timeseries type.
static int planning_flags()
Determine the correct FFTW planning flags given the inputs.
std::size_t nsamples(container_type const &a)
Count the elements in the last dimension of a vector-like container.
Determine if a timeseries type guarantees alignment suitable for SIMD optimizations.
std::size_t num_timeseries_
num_timeseries : num of timeseries contained in a and b
dplan b2tmpb_
b2tmpb_ : fftw plan to execute FFT(b)
dplan a2tmpa_
a2tmpa_ : fftw plan to execute FFT(a)
std::size_t element_count(container_type const &a)
Count the number of elements for a vector-like container.
The top-level namespace for the JayBeams library.