Let us say that we have a database of 5000 entries. Each entry is a 32 point discrete signal (min. amplitude: 0 and max. amplitude: 10 (signal value ranging only in integers)) i.e. each discrete point in the entry signal has a value ranging from 0 to 10. Now, a new signal (again a 32 point discrete signal with each point haveing amplitude range from 0 to 10 and integers only) is captured and it has to be compared with each of the 5000 signals and hamming distance has to be calculated for each of the entry.
The easiest way to do this is to compare sample by sample for each entry and the incoming signal and increment the counter for each entry if there is a mismatch.
For example, the hamming distance for the below one of the database entry and the incoming signal will be 7.
Database (32 point discrete):
5 0 5 0 7 3 0 8 8 9 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 8 0 0 0 0
Signal (32 point discrete):
6 0 5 0 9 4 0 7 0 9 0 0 8 0 0 0 2 3 0 0 0 0 0 0 0 0 0 8 0 0 0 0
Hamming distance for the above entry and the incoming signal is 7.
However, the bottleneck is the sample by sample comparison for each of the entry. The total number of comparisons that have to be made will be 32*5000.
I am looking for an efficient way to calculate the hamming distance, which can make this calculation fast. One of the ways that I think is whether it will be possible to represent the 32 point discrete signal in a reduced (compressed) way (e.g. 4 point coded number, 8-point coded number) and the hamming distance remains the same as before? Or any other technique / idea which can make the hamming distance calculation fast?