Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Naive O(n^2)) time algorithm to compute the closest pair of points among \(n\) points in \(\mathbb{R}^d\).
Documentation
closestPair :: (Ord r, Arity d, Num r) => LSeq 2 (Point d r :+ p) -> Two (Point d r :+ p) Source #
Naive algorithm to compute the closest pair in \(d\) dimensions. Runs in \(O(n^2)\) time (for any constant \(d\)). Note that we need at least two elements for there to be a closest pair.