[Top][All Lists]

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

[Discuss-gnuradio] complex arithmetic

From: David Carr
Subject: [Discuss-gnuradio] complex arithmetic
Date: Tue, 17 Aug 2004 00:00:53 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040815 MultiZilla/

Why does this die with:

gr_complex_mag.cc: In member function `virtual int gr_complex_mag::work(int,
  gr_vector_const_void_star&, gr_vector_void_star&)':
gr_complex_mag.cc:55: error: `cabs' undeclared (first use this function)

I've included <complex> and I think that the cabs function should be there. The conj function works. What am I missing?

David Carr

The file:
#include "config.h"

#include <complex>

#include <gr_complex_mag.h>
#include <gr_io_signature.h>

gr_complex_mag::gr_complex_mag ()
 : gr_sync_block ("complex_mag",
          gr_make_io_signature (1, 1, sizeof (gr_complex)),
          gr_make_io_signature (1, 1, sizeof (float)))

gr_make_complex_mag ()
 return gr_complex_mag_sptr (new gr_complex_mag ());

gr_complex_mag::work (int noutput_items,
                  gr_vector_const_void_star &input_items,
                  gr_vector_void_star &output_items)
 gr_complex *in = (gr_complex *) input_items[0];
 float *out = (float *) output_items[0];
for (int i = 0; i < noutput_items; i++){
   //gr_complex product = in[i] * conj (in[i-1]);
   float ans = cabs (in[i]);
   //out[i] = conj(input_items[i]);

 return noutput_items;

reply via email to

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