diff options
Diffstat (limited to 'gnuradio-core/src/lib/general')
-rw-r--r-- | gnuradio-core/src/lib/general/Makefile.am | 3 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/complex_vec_test.cc | 37 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/complex_vec_test.h | 15 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/complex_vec_test.i | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 2 |
5 files changed, 69 insertions, 0 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3d8a42805..735795789 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -34,6 +34,7 @@ EXTRA_DIST = \ gr_constants.cc.in libgeneral_la_SOURCES = \ + complex_vec_test.cc \ gr_additive_scrambler_bb.cc \ gr_agc_cc.cc \ gr_agc_ff.cc \ @@ -188,6 +189,7 @@ libgeneral_qa_la_SOURCES = \ qa_gri_lfsr.cc grinclude_HEADERS = \ + complex_vec_test.h \ gr_additive_scrambler_bb.h \ gr_agc_cc.h \ gr_agc_ff.h \ @@ -359,6 +361,7 @@ noinst_HEADERS = \ if PYTHON swiginclude_HEADERS = \ + complex_vec_test.i \ general.i \ gr_additive_scrambler_bb.i \ gr_agc_cc.i \ diff --git a/gnuradio-core/src/lib/general/complex_vec_test.cc b/gnuradio-core/src/lib/general/complex_vec_test.cc new file mode 100644 index 000000000..21bca1765 --- /dev/null +++ b/gnuradio-core/src/lib/general/complex_vec_test.cc @@ -0,0 +1,37 @@ +#include <complex_vec_test.h> +#include <stddef.h> + +std::vector<std::complex<float> > +complex_vec_test0() +{ + std::vector<std::complex<float> > r(5); + + for (size_t i = 0; i < r.size(); i++) + r[i] = std::complex<float>(i, i); + + return r; +} + +std::vector<std::complex<float> > +complex_vec_test1(const std::vector<std::complex<float> > &input) +{ + std::vector<std::complex<float> > r(input.size()); + + for (size_t i = 0; i < input.size(); i++) + r[i] = std::complex<float>(input[i].real()+0.5, input[i].imag()-0.5); + + return r; +} + +std::complex<float> +complex_scalar_test0() +{ + return std::complex<float>(5, 5); +} + +std::complex<float> +complex_scalar_test1(std::complex<float> input) +{ + return std::complex<float>(input.real()+0.5, input.imag()-0.5); +} + diff --git a/gnuradio-core/src/lib/general/complex_vec_test.h b/gnuradio-core/src/lib/general/complex_vec_test.h new file mode 100644 index 000000000..f1a8a14e2 --- /dev/null +++ b/gnuradio-core/src/lib/general/complex_vec_test.h @@ -0,0 +1,15 @@ +#include <vector> +#include <complex> + +std::vector<std::complex<float> > +complex_vec_test0(); + +std::vector<std::complex<float> > +complex_vec_test1(const std::vector<std::complex<float> > &input); + +std::complex<float> +complex_scalar_test0(); + +std::complex<float> +complex_scalar_test1(std::complex<float> input); + diff --git a/gnuradio-core/src/lib/general/complex_vec_test.i b/gnuradio-core/src/lib/general/complex_vec_test.i new file mode 100644 index 000000000..1c62cfda2 --- /dev/null +++ b/gnuradio-core/src/lib/general/complex_vec_test.i @@ -0,0 +1,12 @@ +std::vector<std::complex<float> > +complex_vec_test0(); + +std::vector<std::complex<float> > +complex_vec_test1(const std::vector<std::complex<float> > &input); + +std::complex<float> +complex_scalar_test0(); + +std::complex<float> +complex_scalar_test1(std::complex<float> input); + diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 3ad40b218..2c86a6240 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -141,6 +141,7 @@ #include <gr_copy.h> #include <gr_fll_band_edge_cc.h> #include <gr_additive_scrambler_bb.h> +#include <complex_vec_test.h> %} %include "gr_nop.i" @@ -262,3 +263,4 @@ %include "gr_copy.i" %include "gr_fll_band_edge_cc.i" %include "gr_additive_scrambler_bb.i" +%include "complex_vec_test.i" |