Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
AtCoder.Extra.KdTree
Contents
Description
Static, \(k\)-dimensional tree \((k = 2)\).
- Points are fixed on
build
. - Multiple points can exist at the same coordinate.
Examples
>>>
import AtCoder.Extra.KdTree qualified as KT
>>>
import Data.Vector.Unboxed qualified as VU
>>>
let xys = VU.fromList [(0, 0), (1, 1), (4, 2)]
>>>
let kt = KT.build2 xys
>>>
-- Find point indices in [0, 2) x [0, 2) with maximum capacity 3
>>>
KT.findPointsIn kt 0 2 0 2 3
[0,1]
>>>
KT.findNearestPoint kt 3 3
Just 2
Since: 1.2.2.0
K-dimensional tree
Static, \(k\)-dimensional tree \((k = 2)\).
Since: 1.2.2.0
Constructors
KdTree | |
Constructors
\(O(n \log n)\) Creates a KdTree
from \(x\) and \(y\) vectors.
Constraints
- \(|\mathrm{xs}| = |\mathrm{ys}|\).
Since: 1.2.2.0
\(O(n \log n)\) Creates KdTree
from a \((x, y)\) vector.
Constraints
- \(|\mathrm{xs}| = |\mathrm{ys}|\).
Since: 1.2.2.0