HOPS
HOPS class reference
MHO_DelayRate.hh
Go to the documentation of this file.
1 #ifndef MHO_DelayRate_HH__
2 #define MHO_DelayRate_HH__
3 
4 #include <cmath>
5 #include <complex>
6 
8 #include "MHO_TableContainer.hh"
9 
10 #include "MHO_BinaryOperator.hh"
11 #include "MHO_CyclicRotator.hh"
14 #include "MHO_SubSample.hh"
15 
16 #ifdef HOPS_USE_FFTW3
18 #endif
19 
20 namespace hops
21 {
22 
34 class MHO_DelayRate: public MHO_BinaryOperator< visibility_type, weight_type, sbd_type >
35 {
36  public:
37  MHO_DelayRate();
38  virtual ~MHO_DelayRate();
39 
45  void SetReferenceFrequency(double ref_freq) { fRefFreq = ref_freq; };
46 
52  int GetDelayRateSearchSpaceSize() const { return fDRSPSize; }
53 
60  unsigned int CalculateSearchSpaceSize(unsigned int input_size);
61 
62  protected:
66 
76  virtual bool InitializeImpl(const XArgType1* in1, const XArgType2* in2, XArgType3* out) override;
86  virtual bool ExecuteImpl(const XArgType1* in1, const XArgType2* in2, XArgType3* out) override;
87 
88  private:
89  std::size_t fInDims[VIS_NDIM];
90  std::size_t fOutDims[VIS_NDIM];
91 
92  //precomputed per-(ch,dr) interpolation entries - avoids fmod in hot loop.
93  //Declared here so it is visible to all method signatures below.
94  struct InterpEntry
95  {
96  int l0, l1;
97  double w;
98  };
99 
106  void ApplyDataWeights(const XArgType2* in2, XArgType3* out);
114  void ConditionallyResizeOutput(const std::size_t* dims, std::size_t size, XArgType3* out);
115 
122  void ApplyInterpolation(const XArgType1* in1, XArgType3* out);
123 
137  void ApplyInterpolationOptimized(const XArgType1* in1, XArgType3* out, const std::vector< InterpEntry >& table);
138 
144  bool ExecuteImplLegacy(const XArgType1* in1, const XArgType2* in2, XArgType3* out);
145 
153  bool ExecuteImplOptimized(const XArgType1* in1, const XArgType2* in2, XArgType3* out);
154 
155 #ifdef HOPS_USE_FFTW3
157 #else
159 #endif
160 
161  MHO_SubSample< sbd_type > fSubSampler;
162  MHO_CyclicRotator< sbd_type > fCyclicRotator;
163 
165  FFT_ENGINE_TYPE fFFTEngine;
166 
167  int fDRSPSize;
168  double fRefFreq;
169 
170  bool fInitialized;
171 
172  std::vector< InterpEntry > fInterpTable;
173 
174  //pre-rotated version of fInterpTable: l0/l1 adjusted by +np/2 (mod np) so that
175  //ApplyInterpolationOptimized can read directly from the post-FFT (pre-rotation) array,
176  //eliminating the separate CyclicRotator pass from ExecuteImplOptimized.
177  std::vector< InterpEntry > fPreRotatedInterpTable;
178 
179  //staging buffer for ApplyInterpolationOptimized: fDRSPSize rows x nsbd columns
180  std::vector< sbd_type::value_type > fInterpWorkspace;
181 };
182 
183 } // namespace hops
184 
185 #endif
#define VIS_NDIM
Definition: MHO_BaselineContainers.hh:43
An operator that takes two array types as input (XArgType1 and XArgType2) and writes to a single outp...
Definition: MHO_BinaryOperator.hh:22
Class MHO_CyclicRotator.
Definition: MHO_CyclicRotator.hh:29
Class MHO_DelayRate.
Definition: MHO_DelayRate.hh:35
sbd_type XArgType3
Definition: MHO_DelayRate.hh:65
weight_type XArgType2
Definition: MHO_DelayRate.hh:64
void SetReferenceFrequency(double ref_freq)
Setter for reference frequency.
Definition: MHO_DelayRate.hh:45
virtual ~MHO_DelayRate()
Definition: MHO_DelayRate.cc:16
MHO_DelayRate()
Definition: MHO_DelayRate.cc:11
virtual bool ExecuteImpl(const XArgType1 *in1, const XArgType2 *in2, XArgType3 *out) override
Executes MHO_DelayRate operations: zero padding, FFT, cyclic rotation, and interpolation.
Definition: MHO_DelayRate.cc:129
virtual bool InitializeImpl(const XArgType1 *in1, const XArgType2 *in2, XArgType3 *out) override
Initializes MHO_DelayRate with input data and prepares for delay rate calculation.
Definition: MHO_DelayRate.cc:18
unsigned int CalculateSearchSpaceSize(unsigned int input_size)
Calculates the search space size based on input size.
Definition: MHO_DelayRate.cc:261
visibility_type XArgType1
Definition: MHO_DelayRate.hh:63
int GetDelayRateSearchSpaceSize() const
Getter for delay rate search space size.
Definition: MHO_DelayRate.hh:52
Class MHO_EndZeroPadderOptimized.
Definition: MHO_EndZeroPadderOptimized.hh:29
Class MHO_MultidimensionalFastFourierTransformFFTW.
Definition: MHO_MultidimensionalFastFourierTransformFFTW.hh:37
Class MHO_SubSample.
Definition: MHO_SubSample.hh:30
Definition: MHO_AdhocFlagging.hh:18
visibility_type sbd_type
Definition: MHO_BaselineContainers.hh:54
MHO_TableContainer< weight_element_type, baseline_axis_pack > weight_type
Definition: MHO_BaselineContainers.hh:53
MHO_TableContainer< visibility_element_type, baseline_axis_pack > visibility_type
Definition: MHO_BaselineContainers.hh:52