discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Complex numbers in math operations


From: Michael Dickens
Subject: Re: [Discuss-gnuradio] Complex numbers in math operations
Date: Fri, 09 Jun 2017 10:26:14 -0400

Hi Vipin - You're doubly dereferencing IdealFMCW. I think your code should read:
{{{
        *Tx1 = *Tx1 + (IdealFMCW[tapIdx]) * (*hTx1); 
}}}
because the [tapIdx] already dereferences the gr_complex* (IdealFMCW) to be just gr_complex. The error provided by your compiler isn't very helpful. Clang's error reads:
{{{
error: indirection requires pointer operand ('gr_complex' (aka 'complex<float>') invalid)
}}}
which at least gives a clue about the extra dereference but it's great either. Hope this helps! - MLD

On Fri, Jun 9, 2017, at 01:57 AM, Vipin Sharma wrote:
I have a custom block with some input streams being declared as gr_complex type as shown here:

Control_impl::general_work (int noutput_items,
                       gr_vector_int &ninput_items,
                       gr_vector_const_void_star &input_items,
                       gr_vector_void_star &output_items)
    {
      const gr_complex *hTx1 = (const gr_complex *) input_items[0];
      const gr_complex *hTx2 = (const gr_complex *) input_items[1];
      const gr_complex *IdealFMCW = (const gr_complex *) input_items[2];

Later on I use IdealFMCW as follows:

       for(tapIdx=0; tapIdx<TapSize; tapIdx++) {
        *Tx1 = *Tx1 + *(IdealFMCW[tapIdx]) * (*hTx1); 

When I do make, I get compile errors:

error: no match for ‘operator*’ (operand type is ‘const gr_complex {aka const std::complex<float>}’)
         *Tx1 = *Tx1 + *(IdealFMCW[tapIdx]) * (*hTx1); 

I am simply trying to de-reference the pointer (defined by IdealFMCW[tapIdx]) and use the value. What am I not doing right?


reply via email to

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