Processing math: 100%

hgeometry-0.8.0.0: Geometric Algorithms, Data structures, and Data types.

Copyright(C) Frank Staals
Licensesee the LICENSE file
MaintainerFrank Staals
Safe HaskellNone
LanguageHaskell2010

Algorithms.Geometry.ClosestPair.Naive

Description

Naive O(n^2)) time algorithm to compute the closest pair of points among n points in Rd.

Synopsis

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(n2) time (for any constant d). Note that we need at least two elements for there to be a closest pair.

type PP d p r = ArgMin r (Two (Point d r :+ p)) Source #

A pair of points

mkPair :: (Arity d, Num r) => (Point d r :+ p) -> (Point d r :+ p) -> PP d p r Source #

Create a pair of points

pairs :: LSeq 2 a -> NonEmpty (Two a) Source #

Produce all lists from a vec of elements. Since the Vec contains at least two elements, the resulting list is non-empty