43 template <
unsigned nTaps>
Fir1(
const double (&_coefficients)[nTaps]) :
44 coefficients(new double[nTaps]),
45 buffer(new double[nTaps]()),
47 for(
unsigned i=0;i<nTaps;i++) {
48 coefficients[i] = _coefficients[i];
57 Fir1(std::vector<double> _coefficients) {
58 initWithVector(_coefficients);
66 Fir1(
double *coefficients,
unsigned number_of_taps);
74 Fir1(
const char* coeffFile,
unsigned number_of_taps = 0);
81 Fir1(
unsigned number_of_taps);
95 const double *coeff = coefficients;
96 const double *
const coeff_end = coefficients + taps;
98 double *buf_val = buffer + offset;
103 while(buf_val >= buffer)
104 output_ += *buf_val-- * *coeff++;
106 buf_val = buffer + taps-1;
108 while(coeff < coeff_end)
109 output_ += *buf_val-- * *coeff++;
125 double *coeff = coefficients;
126 const double *coeff_end = coefficients + taps;
128 double *buf_val = buffer + offset;
130 while(buf_val >= buffer) {
131 *coeff++ += *buf_val-- * error * mu;
134 buf_val = buffer + taps-1;
136 while(coeff < coeff_end) {
137 *coeff++ += *buf_val-- * error * mu;
170 void getCoeff(
double* coeff_data,
unsigned number_of_taps)
const;
176 return std::vector<double>(coefficients,coefficients+taps);
190 double *buf_val = buffer;
194 for(
unsigned i = 0; i < taps; i++) {
195 p += (*buf_val) * (*buf_val);
203 void initWithVector(std::vector<double> _coefficients);
205 double *coefficients;