1.2.3-SNAPSHOT Arrow_down_16x16

lee-distance

incanter.stats

  • (lee-distance a b q)
http://en.wikipedia.org/wiki/Lee_distance

In coding theory, the Lee distance is a distance between two strings x1x2...xn and y1y2...yn of equal length n over the q-ary alphabet {0,1,,q-1} of size q >= 2. It is metric.

If q = 2 or q = 3 the Lee distance coincides with the Hamming distance.

The metric space induced by the Lee distance is a discrete analog of the elliptic space.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/stats.clj:3127 top

(defn lee-distance
"http://en.wikipedia.org/wiki/Lee_distance

In coding theory, the Lee distance is a distance between two strings x1x2...xn and y1y2...yn of equal length n over the q-ary alphabet {0,1,Ķ,q-1} of size q >= 2. It is metric.

If q = 2 or q = 3 the Lee distance coincides with the Hamming distance.

The metric space induced by the Lee distance is a discrete analog of the elliptic space.
"
[a b q]
(if (and (integer? a) (integer? b))
  (lee-distance (str a) (str b) q)
(let [_ (assert (= (count a) (count b)))]
(apply
 tree-comp-each 
  + 
  (fn [x]
    (let [diff (abs (apply - (map int x)))]
      (min diff (- q diff))))
  (map vector a b)))))
Vars in incanter.stats/lee-distance: + - and apply defn fn integer? let map min str vector
Used in 0 other vars

Comments top

No comments for lee-distance. Log in to add a comment.