discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] blocks.complex_to_arg() implementation


From: Tom Rondeau
Subject: Re: [Discuss-gnuradio] blocks.complex_to_arg() implementation
Date: Wed, 13 Aug 2014 10:37:11 -0400

On Wed, Aug 13, 2014 at 10:15 AM, Daniele Nicolodi <address@hidden> wrote:
Hello,

I haven't checked if it is true for the code currently in git (some
network problems here, I cannot access the repository), but in GNURadio
3.7.2 the complex_to_arg() block is implemented with an atan2() function
which has a quite large error (for my purposes, at least) and not the
standard math library atan2() function.

I think that this should be mentioned in the documentation. Should I
send a patch to add this info to the documentation?

The version we have in there is much (MUCH) faster than the libm atan2 function. So yes, we trade off a bit of error for a massive computational gain. The error is very small from what I recall, expect in a few instances (near 0 or near pi/2 or something like that). Having a graph of the error somewhere would be helpful.

But yes, I agree. Mentioning that this function is a fast approximation in the documentation would be a good thing. Please send a patch (via a github pull request preferably).

 
Furthermore, even if the block does not use Volk for the computation the
block constructor still enforces alignment of the buffer to satisfy Volk
requirements, or at least this is what I believe the following code does:

      const int alignment_multiple =
        volk_get_alignment() / sizeof(float);
      set_alignment(std::max(1,alignment_multiple));

I think this should be removed. Should I send a patch for this as well?

There is interest in adding a complex_to_arg_slow() or similar block
that trades execution speed for precision?

Thanks. Cheers,
Daniele

The fast atan method we use is still faster than what we have in VOLK. I remember testing this out myself, which included putting that code into the constructor. However, take a look at this post:

http://www.trondeau.com/blog/2012/2/17/volk-benchmarking.html

We see an improvement in speed of blocks by doing the alignment. Actually, I think that all blocks should probably have their alignment set whether or not they use VOLK. But that would be a lot of work to do correctly with all of our blocks to make sure it's done right and is actually giving us a benefit. But having test this one in particular, no, I don't see any need to remove this code.

Tom

 

reply via email to

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