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 weightright in the given context. Based on that hope/assumption, this might be what you were after -Thus, each 3D slice of
outwould give you such a3 x 3matrix with1hamming weight between them andA.It looks like you have
9such matrices -Edit
For big
n, you need to use loops it seems -