Gray Codes are used for Goniometers,
a Hamiltonian Circuit on a Hypercube,
and for searches and optimizations
of functions of a few variables each
of which takes a few discrete values.
For details see file GrayCode.txt
that is included with this submission.
it really help! thanks! :)
You can get at least a 5-10x speedup in the integer routines by changing the routines to cast floats to the correct uint** type and replacing the fix(0.5*k) with bitshift(k, -1).
For the 10-12 bit long codes I'm working with, graytest(10) and (12), the ratio goes from ~ 400 to 1500/2800 upon changing the routine, including the appropriate type checking and casting.
Also, the fix() call in int2gray() at least doesn't play nicely with a uint** passed in. I haven't checked gray2int().
That said, I've gotten great use out of (my modified versions of) these routines. Thanks for providing them.
great stufff ;)