! The answer by @cbos is correct in spirit but wrong in its details.
In an answer on crypto.SE, I wrote
"The Berlekamp-Massey algorithm is an iterative algorithm that solves the following problem.
Given a sequence $s_0, s_1, s_2, \ldots$ of elements of a field, find the
shortest linear feedback shift register (LFSR) that generates ...
In 4-bit packed binary-coded decimal (BCD) each of your strings will take 4*32 = 128 bits, which just fits in two 64-bit registers. With some binary wizardry you can calculate the Hamming distance in two highly parallelized runs working on the first 16 and the last 16 packed BCD's. Because your strings are so short, I doubt you can go any faster by higher-...
For complex matrices, the concept of orthogonality is replaced by unitarity. If $^H$ denotes the conjugate transpose of a matrix, we should check that $W$ is a unitary matrix (up to a scaling factor) via equations:
$$W^* W = WW^* =\lambda I$$
with $\lambda\neq 0$, which you can test positively with:
What is missing in your loop, and especially ...
I give an explanation that avoids the pejorative comments of Engineer.
First question: can you explain me these two definitions of perfect code?
Those are not two definitions of perfect codes but rather a single somewhat poorly-phrased definition of a perfect code. It should read
A perfect (binary) $t$-error-correcting code of block length $n$ is a ...
There's no lower and upper general limits, aside from the fact that you need to transmit at least 1 bit, and that your spreading sequence should be longer than 1.
By the way, you typically apply spreading to symbols, not bits.
Spreading sequences can be binary, but they don't have to be.
So, bits is the wrong unit here; symbols for $i$ would be right, ...
Your problem might be easier if you trade memory for speed.
First of all, you only got ten values, so the whole "hamming distance of sub-element" can be sped up by either a elegant SIMD, or really by a 10x10 look-up table.
Then, you "blow up" your 5000 entry table – which really, if we don't pack at all and use native types, i.e. 1 byte per sub-entry, is ...
First, note that any form of compression, clustering etc. will require its own computational power. So only if it can significantly reduce the complexity such that the overall task has a reduced complexity, then the extra processing is useful. This turns out not to be the case often.
My suggestion is to make the procedure itself as efficient as possible. ...