[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11593 - gnuradio/branches/developers/n4hy/pfb_iir2/gn
From: |
n4hy |
Subject: |
[Commit-gnuradio] r11593 - gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general |
Date: |
Fri, 14 Aug 2009 12:26:06 -0600 (MDT) |
Author: n4hy
Date: 2009-08-14 12:26:06 -0600 (Fri, 14 Aug 2009)
New Revision: 11593
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
Log:
I hate to love swig. I hope soon I won't hate it
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
2009-08-14 18:10:11 UTC (rev 11592)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
2009-08-14 18:26:06 UTC (rev 11593)
@@ -36,14 +36,14 @@
gr_iirdes::transfer_function
-gr_iirdes::iirdes(filter_design_type fdtype,
+gr_iirdes::iirdes(gr_iirdes::filter_design_type fdtype,
vector<double> Wpassband,
vector<double> Wstopband,
double RipplePassband,
double RippleStopband)
{
int frqsize = Wpassband.size();
- filter_response d_filter_response;
+ gr_iirdes::filter_response d_filter_response;
bool error = true;
double Rp = RipplePassband;
double Rs = RippleStopband;
@@ -111,7 +111,7 @@
}
vector<double>
-gr_iirdes::butterord(filter_response fresp,
+gr_iirdes::butterord(gr_iirdes::filter_response fresp,
vector<double> Wp,
vector<double> Ws,
double Rp,
@@ -120,7 +120,7 @@
double qs = log(pow(10.,(Rs/10.0)) - 1.0);
double qp = log(pow(10.,(Rp/10.0)) - 1.0);
switch (fresp) {
- case LOWPASS: {
+ case gr_iirdes::LOWPASS: {
vector<double> rtn(2);
if (Wp[0]>=Ws[0])
throw std::invalid_argument ("For lowpass filter Wp < Ws");
@@ -132,7 +132,7 @@
rtn[1] = atan(rtn[1])/M_PI;
return rtn;
}
- case HIGHPASS: {
+ case gr_iirdes::HIGHPASS: {
vector<double> rtn(2);
if (Ws[0]>=Wp[0]) throw std::invalid_argument ("For highpass filter Wp >
Ws");
Ws[0]= 0.5-Ws[0];
@@ -144,7 +144,7 @@
rtn[1] = 0.5-atan(rtn[1])/M_PI;
return rtn;
}
- case BANDPASS: {
+ case gr_iirdes::BANDPASS: {
vector<double> rtn(3);
if ((Ws[0]>=Wp[0]) ||
(Wp[0]>=Wp[1]) ||
@@ -165,7 +165,7 @@
return rtn;
}
- case BANDSTOP: {
+ case gr_iirdes::BANDSTOP: {
vector<double> rtn(3);
if ((Wp[0]>=Ws[0]) ||
(Ws[0]>=Ws[1]) ||
@@ -191,26 +191,26 @@
}
gr_iirdes::transfer_function
-gr_iirdes::butter_tf(filter_response fresp,
+gr_iirdes::butter_tf(gr_iirdes::filter_response fresp,
vector<double> Wc)
{
gr_iirdes::transfer_function rtn;
switch (fresp) {
- case LOWPASS: {
+ case gr_iirdes::LOWPASS: {
}
- case HIGHPASS: {
+ case gr_iirdes::HIGHPASS: {
}
- case BANDPASS: {
+ case gr_iirdes::BANDPASS: {
}
- case BANDSTOP: {
+ case gr_iirdes::BANDSTOP: {
}}
return rtn;
}
vector<double>
-gr_iirdes::chebyshevord(filter_response fresp,
+gr_iirdes::chebyshevord(gr_iirdes::filter_response fresp,
vector<double> Wp,
vector<double> Ws,
double Rp,
@@ -222,7 +222,7 @@
}
gr_iirdes::transfer_function
-gr_iirdes::chebyshev_tf(filter_response fresp,
+gr_iirdes::chebyshev_tf(gr_iirdes::filter_response fresp,
vector<double> Wc)
{
gr_iirdes::transfer_function rtn;
@@ -242,7 +242,7 @@
}
gr_iirdes::transfer_function
-gr_iirdes::invchebyshev_tf(filter_response fresp,
+gr_iirdes::invchebyshev_tf(gr_iirdes::filter_response fresp,
vector<double> Wc)
{
gr_iirdes::transfer_function rtn;
@@ -250,7 +250,7 @@
}
vector<double>
-gr_iirdes::ellipord(filter_response fresp,
+gr_iirdes::ellipord(gr_iirdes::filter_response fresp,
vector<double> Wp,
vector<double> Ws,
double Rp,
@@ -262,7 +262,7 @@
}
gr_iirdes::transfer_function
-gr_iirdes::ellip_tf(filter_response fresp,
+gr_iirdes::ellip_tf(gr_iirdes::filter_response fresp,
vector<double> Wc)
{
gr_iirdes::transfer_function rtn;
@@ -270,7 +270,7 @@
}
vector<double>
-gr_iirdes::besselord(filter_response fresp,
+gr_iirdes::besselord(gr_iirdes::filter_response fresp,
vector<double> Wp,
vector<double> Ws,
double Rp,
@@ -282,7 +282,7 @@
}
gr_iirdes::transfer_function
-gr_iirdes::bessel_tf(filter_response fresp,
+gr_iirdes::bessel_tf(gr_iirdes::filter_response fresp,
vector<double> Wc)
{
gr_iirdes::transfer_function rtn;
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
2009-08-14 18:10:11 UTC (rev 11592)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
2009-08-14 18:26:06 UTC (rev 11593)
@@ -54,25 +54,7 @@
BESSEL = 4, // Bessel
};
- typedef struct _tf {
- std::vector<double> b;
- std::vector<double> a;
- } transfer_function;
- typedef struct _zpk {
- std::vector<gr_complexd> z;
- std::vector<gr_complexd> p;
- int order;
- double k;
- } zpk;
-
- typedef struct _sos {
- std::vector<double> num;
- std::vector<double> den;
- double g;
- } sos;
-
-
// ... class methods ... (public)
/*!
@@ -87,7 +69,6 @@
*/
-
static std::vector<double>
butterord(filter_response ft,
std::vector<double> Wp,
@@ -95,6 +76,30 @@
double Rp,
double Rs);
+
+ typedef struct transfer_function {
+ std::vector<double> b;
+ std::vector<double> a;
+ } transfer_function;
+
+private:
+
+
+ typedef struct _zpk {
+ std::vector<gr_complexd> z;
+ std::vector<gr_complexd> p;
+ int order;
+ double k;
+ } zpk;
+
+ typedef struct _sos {
+ std::vector<double> num;
+ std::vector<double> den;
+ double g;
+ } sos;
+
+
+
static transfer_function
butter_tf(filter_response ft,
std::vector<double> Wc);
@@ -157,13 +162,15 @@
double Rp,
double Rs);
- // ... class methods ... (private)
-
-private:
+
static zpk
sftrans(zpk ZeroPoleK,
std::vector<double> W,
bool stop);
+ // ... class members and methods ... (private)
+
+
+
};
#endif
Modified:
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
===================================================================
---
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
2009-08-14 18:10:11 UTC (rev 11592)
+++
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
2009-08-14 18:26:06 UTC (rev 11593)
@@ -26,8 +26,10 @@
%rename(iirdes) gr_iirdes;
+
class gr_iirdes {
+public:
enum filter_response {
LOWPASS = 0, // Lowpass filter, cutoff in (0,.5)
@@ -44,24 +46,7 @@
BESSEL = 4, // Bessel
};
- typedef struct _tf {
- std::vector<double> b;
- std::vector<double> a;
- } transfer_function;
- typedef struct _zpk {
- std::vector<gr_complexd> z;
- std::vector<gr_complexd> p;
- double k;
- } zpk;
-
- typedef struct _sos {
- std::vector<double> num;
- std::vector<double> den;
- double g;
- } sos;
-
-
// ... class methods ... (public)
/*!
@@ -84,67 +69,10 @@
double Rp,
double Rs);
- static transfer_function
- butter_tf(filter_response ft,
- std::vector<double> Wc);
- static std::vector<double>
- chebyshevord(filter_response ft,
- std::vector<double> Wp,
- std::vector<double> Ws,
- double Rp,
- double Rs);
+ typedef struct transfer_function {
+ std::vector<double> b;
+ std::vector<double> a;
+ } transfer_function;
- static transfer_function
- chebyshev_tf(filter_response ft,
- std::vector<double> Wc);
-
- static std::vector<double>
- invchebyshevord(filter_response ft,
- std::vector<double> Wp,
- std::vector<double> Ws,
- double Rp,
- double Rs);
-
- static transfer_function
- invchebyshev_tf(filter_response ft,
- std::vector<double> Wc);
-
- static std::vector<double>
- ellipord(filter_response ft,
- std::vector<double> Wp,
- std::vector<double> Ws,
- double Rp,
- double Rs);
-
- static transfer_function
- ellip_tf(filter_response ft,
- std::vector<double> Wc);
-
- static std::vector<double>
- besselord(filter_response ft,
- std::vector<double> Wp,
- std::vector<double> Ws,
- double Rp,
- double Rs);
-
- static transfer_function
- bessel_tf(filter_response ft,
- std::vector<double> Wc);
-
- static sos
- tf2sos(transfer_function tf);
-
-
- static zpk
- tf2zpg(transfer_function tf);
-
- static transfer_function
- iirdes(filter_design_type fdtype,
- std::vector<double> Wp,
- std::vector<double> Ws,
- double Rp,
- double Rs);
-
-
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11593 - gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general,
n4hy <=