Imported Upstream version 3.2.2
[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  * \ingroup filter_design
34  *
35  * Calculates the optimal (in the Chebyshev/minimax sense) FIR filter
36  * inpulse reponse given a set of band edges, the desired reponse on
37  * those bands, and the weight given to the error in those bands.
38  *
39  * \param order             filter order (number of taps in the returned filter - 1)
40  * \param bands             frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]
41  * \param ampl              desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]
42  * \param error_weight      weighting applied to each band (usually 1)
43  * \param filter_type       one of "bandpass", "hilbert" or "differentiator"
44  * \param grid_density      determines how accurately the filter will be constructed. \
45  *                              The minimum value is 16; higher values are slower to compute.
46  *
47  * Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2)
48  *
49  * \returns vector of computed taps
50  *
51  * \throws std::runtime_error if args are invalid or calculation fails to converge.
52  */
53
54 std::vector<double>
55 gr_remez (int order,
56           const std::vector<double> &bands,
57           const std::vector<double> &ampl,
58           const std::vector<double> &error_weight,
59           const std::string filter_type = "bandpass",
60           int grid_density = 16
61           ) throw (std::runtime_error);
62
63
64 #endif /* INCLUDED_GR_REMEZ_H */