commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11596 - gnuradio/branches/developers/n4hy/pfb_iir2/gn


From: n4hy
Subject: [Commit-gnuradio] r11596 - gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general
Date: Sat, 15 Aug 2009 10:18:31 -0600 (MDT)

Author: n4hy
Date: 2009-08-15 10:18:31 -0600 (Sat, 15 Aug 2009)
New Revision: 11596

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:
where swig is great outweighs where it stinks, but just

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-15 02:49:48 UTC (rev 11595)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.cc
       2009-08-15 16:18:31 UTC (rev 11596)
@@ -299,39 +299,38 @@
 gr_iirdes::zpk
 gr_iirdes::tf2zpg(gr_iirdes::transfer_function tf)
 {
-  int size = tf.a.size();
+  int size = tf.order;
   gsl_poly_complex_workspace *w;
-  double *a,*b,*z;
   gr_iirdes::zpk rtn;
-  rtn.z.reserve(size);
-  rtn.p.reserve(size);
+  double *z;
   
   if (size < 2) throw std::invalid_argument
                  ("transfer function to pole, zero, gain calculation requires 
order 2 or greater");
 
+  rtn.z = new gr_complexd(size);
+  rtn.p = new gr_complexd(size);
   w = gsl_poly_complex_workspace_alloc(size);
-  z = new double(size);
-  a = new double(size);
-  b = new double(size);
+  z = new double(2*size);
 
+
   for (int i=0;i<size;i++) {
-    a[i]=tf.a[i];
-    b[i]=tf.b[i];
     z[2*i]=0;
     z[2*i+1]=0;
   }
   
   // compute zeros
-  gsl_poly_complex_solve (&a[0], size, w, z);
+  gsl_poly_complex_solve (tf.a, size, w, z);
   // store them in the zeros in the zpk array
   for (int i=0;i<size;i++)
     rtn.z[i] = gr_complexd(z[2*i],z[2*i+1]);
 
   // compute poles
-  gsl_poly_complex_solve (&b[0], size, w, z);
+  gsl_poly_complex_solve (tf.b, size, w, z);
   for (int i=0;i<size;i++)
     rtn.p[i] = gr_complexd(z[2*i],z[2*i+1]);
 
+  delete z;
+
   rtn.k = tf.b[0]/tf.a[0];
 
   return 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-15 02:49:48 UTC (rev 11595)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.h
        2009-08-15 16:18:31 UTC (rev 11596)
@@ -77,24 +77,24 @@
            double Rs);
 
 
-  typedef struct transfer_function {
-    std::vector<double> b;
-    std::vector<double> a;
+  typedef struct _transfer_function {
+    int order;
+    double *b;
+    double *a;
   } transfer_function;
 
-private:
 
 
   typedef struct _zpk {
-    std::vector<gr_complexd> z;
-    std::vector<gr_complexd> p;
+    gr_complexd *z;
+    gr_complexd *p;
     int order;
     double k;
   } zpk;
 
   typedef struct _sos {
-    std::vector<double> num;
-    std::vector<double> den;
+    double num[3];
+    double den[3];
     double g;
   } sos;
 

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-15 02:49:48 UTC (rev 11595)
+++ 
gnuradio/branches/developers/n4hy/pfb_iir2/gnuradio-core/src/lib/general/gr_iirdes.i
        2009-08-15 16:18:31 UTC (rev 11596)
@@ -71,8 +71,9 @@
 
 
   typedef struct transfer_function {
-    std::vector<double> b;
-    std::vector<double> a;
+    int order;
+    double *b;
+    double *a;
   } transfer_function;
 
 };





reply via email to

[Prev in Thread] Current Thread [Next in Thread]