gray2bin2 {adana} | R Documentation |
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).
gray2bin2(gray)
gray |
A gray coded number. |
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.
Returns the binary coded integer equivalent of the input number.
Zeynel Cebeci & Erkut Tekeli
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.
gray = c(1,1,1,0)
gray2bin2(gray) # returns 1011
gray = c(1,1,1,1)
gray2bin2(gray) # returns 1010