gray2bin2 {adana} | R Documentation |
Convert gray code to binary integer #2
Description
The function gray2bin2 converts a gray-coded integer to a binary-coded number. The conversion function is performed according to the algorithm given by Chakraborty and Janikov (2003).
Usage
gray2bin2(gray)
Arguments
gray |
A gray coded number. |
Details
To convert gray coded numbers to binary numbers, a conversion function is defined using the algorithm given by Chakraborty and Janikov (2003). This function is a generic function that does not use the xor operator.
Value
Returns the binary coded integer equivalent of the input number.
Author(s)
Zeynel Cebeci & Erkut Tekeli
References
Chakraborty, U.K., and Janikow C.Z. (2003). An analysis of Gray versus binary encoding in genetic search. Information Sciences, 156 (3-4), 253-269.
See Also
Examples
gray = c(1,1,1,0)
gray2bin2(gray) # returns 1011
gray = c(1,1,1,1)
gray2bin2(gray) # returns 1010
[Package adana version 1.1.0 Index]