Euclidean Distance

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Euclidean Distance as PDF for free.

More details

  • Words: 571
  • Pages: 3
Euclidean distance In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, which can be proven by repeated application of the Pythagorean theorem. By using this formula as distance, Euclidean space becomes a metric space (even a Hilbert space). The associated norm is called the Euclidean norm. Older literature refers to this metric as Pythagorean metric. The technique has been rediscovered numerous times throughout history, as it is a logical extension of the Pythagorean theorem.

Examples The Hamming distance between: •

1011101 and 1001001 is 2.



2173896 and 2233796 is 3.



"toned" and "roses" is 3.

For binary strings a and b the Hamming distance is equal to the number of ones in a XOR b. The metric space of length-n binary strings, with the Hamming distance, is known as the Hamming cube; it is equivalent as a metric space to the set of distances between vertices in a hypercube graph. One can also view a binary string of length n as a vector in by treating each symbol in the string as a real coordinate; with this embedding, the strings form the vertices of an n-dimensional hypercube, and the Hamming distance of the strings is equivalent to the Manhattan distance between the vertices.

History and applications The Hamming distance is named after Richard Hamming, who introduced it in his fundamental paper about error-detecting and error-correcting codes (1950) introducing Hamming codes. It is used in telecommunication to count the number of flipped bits in a fixed-length binary word as an estimate of error, and therefore is sometimes called the signal distance. Hamming weight analysis of bits is used in several disciplines including information theory, coding theory, and cryptography. However, for comparing strings of different lengths, or strings where not just substitutions but also insertions or deletions have to be expected, a more sophisticated metric like the Levenshtein distance is more appropriate. For q-ary strings over an alphabet of size q ≥ 2 the Hamming distance is applied in case of orthogonal modulation, while the Lee distance is used for phase modulation. If q = 2 or q = 3 both distances coincide. The Hamming distance is also used in systematics as a measure of genetic distance.On a grid (such as a chessboard), the points at a Hamming distance of 1 constitute the von Neumann neighborhood of that point.

Algorithm example The Python function hamdist() computes the Hamming distance between two strings (or other iterable objects) of equal length. def hamdist(s1, s2): assert len(s1) == len(s2) return sum(ch1 != ch2 for ch1, ch2 in zip(s1, s2))

The following C function will compute the Hamming distance of two integers (considered as binary values, that is, as sequences of bits). The running time of this procedure is proportional to the Hamming distance rather than to the number of bits in the inputs. It works by XORing the two inputs, and then counting the number of bits set in the result. unsigned hamdist(unsigned x, unsigned y) { unsigned dist = 0, val = x ^ y; // Count the number of set bits (Knuth's algorithm) while(val) { ++dist; val &= val - 1; } return dist; }

File:Viterbi decoder hardware implementation BMU.png

Summary Description A branch metric unit Source self-made Date created 23. Apr. 2006 Author Alexey Kuznetsov - Ring0 Permission this image is in a public domain (Reusing this image)

Related Documents