r - Sort rows of matrix according to number of different digits -
I have a matrix that contains lines of binary vectors:
libraries (gtools) Mat and lieutenant; - Repeats the devices (2,6, V = C (0,1), declares = TRUE)
I would like to sort the rows of the matrix so that each row differs. Only 1 point from your direct neighbors (up and down)
Is this possible?
Interesting questions! The way in which I thought that it was thought of to be done, it is to recapture such matrix with a small number of digits in it. Suppose we have an N-digit matrix (which contains all 2 ^ N unique en-bit sequences) where each neighbor is different in more than one. If we do rbind
with its matrix (according to the lines), then each row of the result will be more than 1, and in between the two rows will be equally identical. We can add 1 in front of the first half and 1 in front of the second half. All 2 ^ (n + 1) in the result are unique (n + 1) -bit sequence, and all neighbors have more distance than each other.
For the base case, we (0 1) for 1-digit matrix.
get.mat
An interesting side effect for the construction of these matrix is that the first and the last lines are o 1 distance from each other.
Comments
Post a Comment