Given a square binary matrix. I want to get all possible binary matrices which are at d
Hamming distance apart.
Suppose
A=[1 0 1;
0 1 1;
1 1 0].
Then a matrix which is one (d) Hamming distance apart is
[0 0 1;
0 1 1;
1 1 0].
Any help in Matlab base coding?
I am hoping that I got the definition of
hamming weight
right in the given context. Based on that hope/assumption, this might be what you were after -Thus, each 3D slice of
out
would give you such a3 x 3
matrix with1
hamming weight between them andA
.It looks like you have
9
such matrices -Edit
For big
n
, you need to use loops it seems -