Displaying 1 result from an estimated 1 matches for "nhrp".
Did you mean:
chrp
2009 Feb 18
2
how to randomly eliminate half the entries in a vector?
...trings
# differ (easy xor)
#
# 2. randomly selects half of those positions
#
# 3. exchanges (flips) the bits in those positions for
# both
#
HUX <- function(b1, b2)
{
# 1. find differing bits
r=xor(b1, b2)
# positions where bits differ
different = which(r==TRUE)
cat("\nhrp: ", different, "\n")
# 2. ??? how to do this best so that each time
# a different half subset is selected? I.e.,
# sum(r)/2 positions.
# 3. this flips *all* positions, should really only flip
# half of them (randomly selected half)
new_b1 = b1
new_b2 =...