MNE-CPP  beta 1.0
parksmcclellan.h
Go to the documentation of this file.
1 //=============================================================================================================
63 #ifndef PARKSMCCLELLAN_H
64 #define PARKSMCCLELLAN_H
65 
66 //=============================================================================================================
67 // INCLUDES
68 
69 #include "utils_global.h"
70 #include <vector>
71 
72 //Eigen
73 #include <Eigen/Core>
74 #include <Eigen/SparseCore>
75 
76 //Qt
77 #include <QObject>
78 #include <QMetaObject>
79 
80 #define BIG 4096 // Used to define array sizes. Must be somewhat larger than 8 * MaxNumTaps
81 #define SMALL 256
82 #define M_2PI 6.28318530717958647692
83 #define ITRMAX 50 // Max Number of Iterations. Some filters require as many as 45 iterations.
84 #define MIN_TEST_VAL 1.0E-6 // Min value used in LeGrangeInterp and GEE
85 
86 //*************************************************************************************************************
87 //=============================================================================================================
88 // DEFINE NAMESPACE UTILSLIB
89 //=============================================================================================================
90 
91 using namespace Eigen;
92 
93 namespace UTILSLIB
94 {
95 
96 class UTILSSHARED_EXPORT ParksMcClellan : public QObject
97 {
98  Q_OBJECT
99  Q_ENUMS(TPassType) //makes enum available to the class' Qt meta object
100 
101 public:
102  enum TPassType {LPF, HPF, BPF, NOTCH };
103 
104  ParksMcClellan();
105 
106  //=========================================================================================================
128  ParksMcClellan(int NumTaps, double OmegaC, double BW, double ParksWidth, TPassType PassType);
129 
130  ~ParksMcClellan();
131 
132  //=========================================================================================================
137  void init(int NumTaps, double OmegaC, double BW, double ParksWidth, TPassType PassType);
138 
139  //=========================================================================================================
142  void CalcParkCoeff2(int NBANDS, int NFILT);
143 
144  //=========================================================================================================
148  double LeGrangeInterp2(int K, int N, int M);
149 
150  //=========================================================================================================
155  double GEE2(int K, int N);
156 
157  //=========================================================================================================
160  int Remez2(int GridIndex);
161 
162  //=========================================================================================================
166  bool ErrTest(int k, int Nut, double Comp, double *Err);
167 
168  //=========================================================================================================
173  void CalcCoefficients();
174 
175  RowVectorXd FirCoeff;
177 private:
178  int HalfTapCount;
179  VectorXi ExchangeIndex;
180  VectorXd LeGrangeD;
181  VectorXd Alpha;
182  VectorXd CosOfGrid;
183  VectorXd DesPlus;
184  VectorXd Coeff;
185  VectorXd Edge;
186  VectorXd BandMag;
187  VectorXd InitWeight;
188  VectorXd DesiredMag;
189  VectorXd Grid;
190  VectorXd Weight;
191 
192  bool InitDone2;
193 
194 };
195 
196 }
197 
198 #endif // PARKSMCCLELLAN_H
#define UTILSSHARED_EXPORT
Definition: utils_global.h:57
utils library export/import macros.