Loading...
 
Bugs, features, coding issues

Bugs, features, coding issues


Calculation of Hopping Sequence

The current implementation to calculate the hopping sequence has a severe bug.
This bug affects both the "MATLAB" and the "C" implementation.

The problem is with the accuracy of the intermediate results.

Best show with the "C" implementation (code from "hop_index.c"):

''unsigned
janus_hop_index(unsigned idx, unsigned alpha, unsigned block_size)
{
janus_real_t u1 = JANUS_CEILidx + 1) / ((block_size - 1.0) * block_size;
janus_real_t u2 = JANUS_FLOOR(idx / (block_size - 1));
unsigned gp = (idx % (block_size - 1)) + 1;
janus_real_t g1 = JANUS_POW(alpha, gp);
janus_real_t g2 = JANUS_POW(alpha, gp + gp);
return (unsigned)JANUS_FMOD(u1 * g1 + u2 * g2, block_size);
}
''

Try to calculate a sequence with 24 different hops.
The "primitive" routine calculates: alpha = 5, block_size = 23.

With these numbers the "hop_index" routine above gives the following results:

0, gp= 1, g2 = 25.0
1, gp= 2, g2 = 625.0
2, gp= 3, g2 = 15625.0
3, gp= 4, g2 = 390625.0
4, gp= 5, g2 = 9765625.0
5, gp= 6, g2 = 244140625.0
6, gp= 7, g2 = 6103515625.0
7, gp= 8, g2 = 152587890625.0
8, gp= 9, g2 = 3814697265625.0
9, gp=10, g2 = 95367431640625.0
10, gp=11, g2 = 2384185791015625.0
11, gp=12, g2 = 59604644775390624.0