Imported Upstream version 3.0.4
[debian/gnuradio] / gnuradio-core / src / lib / general / gr_remez.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef INCLUDED_GR_REMEZ_H
24 #define INCLUDED_GR_REMEZ_H
25
26 #include <gr_types.h>
27 #include <string>
28 #include <stdexcept>
29
30 /*!
31  * \brief Parks-McClellan FIR filter design.
32  *
33  *
34  * Calculates the optimal (in the Chebyshev/minimax sense) FIR filter
35  * inpulse reponse given a set of band edges, the desired reponse on
36  * those bands, and the weight given to the error in those bands.
37  *
38  * \param order             filter order (number of taps in the returned filter - 1)
39  * \param bands             frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]
40  * \param ampl              desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]
41  * \param error_weight      weighting applied to each band (usually 1)
42  * \param filter_type       one of "bandpass", "hilbert" or "differentiator"
43  * \param grid_density      determines how accurately the filter will be constructed. \
44  *                              The minimum value is 16; higher values are slower to compute.
45  *
46  * Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2)
47  *
48  * \returns vector of computed taps
49  *
50  * \throws std::runtime_error if args are invalid or calculation fails to converge.
51  */
52
53 std::vector<double>
54 gr_remez (int order,
55           const std::vector<double> &bands,
56           const std::vector<double> &ampl,
57           const std::vector<double> &error_weight,
58           const std::string filter_type = "bandpass",
59           int grid_density = 16
60           ) throw (std::runtime_error);
61
62
63 #endif /* INCLUDED_GR_REMEZ_H */