public class PointWithDistanceUtil extends Object
PointWithDistance
.Constructor and Description |
---|
PointWithDistanceUtil() |
Modifier and Type | Method and Description |
---|---|
static <L> List<LabeledVector<L>> |
transfomToListOrdered(Queue<PointWithDistance<L>> points)
Util method that transforms collection of
PointWithDistance to array of LabeledVector . |
static <L> void |
tryToAddIntoHeap(Queue<PointWithDistance<L>> heap,
int k,
LabeledVector<L> dataPnt,
double distance)
Util method that adds data point into heap if it fits (if heap size is less than
k or a distance from
taget point to data point is less than a distance from target point to the most distant data point in heap). |
static <L> void |
tryToAddIntoHeap(Queue<PointWithDistance<L>> heap,
int k,
Vector pnt,
List<LabeledVector<L>> dataPnts,
DistanceMeasure distanceMeasure)
Util method that adds data points into heap if they fits (if heap size is less than
k or a distance from
taget point to data point is less than a distance from target point to the most distant data point in heap). |
public static <L> List<LabeledVector<L>> transfomToListOrdered(Queue<PointWithDistance<L>> points)
PointWithDistance
to array of LabeledVector
. Be aware
that this method uses Queue.remove()
method to extract elements and the asymptotic complexity of this
method depends on it (in case of PriorityQueue
it will be O(log(n))
, in case of
LinkedList
it will be O(n)
).L
- Label type.points
- Collections of PointWithDistance
.LabeledVector
public static <L> void tryToAddIntoHeap(Queue<PointWithDistance<L>> heap, int k, LabeledVector<L> dataPnt, double distance)
k
or a distance from
taget point to data point is less than a distance from target point to the most distant data point in heap).L
- Label type.heap
- Heap with closest points.k
- Number of neighbours.dataPnt
- Data point to be added.distance
- Distance to target point.public static <L> void tryToAddIntoHeap(Queue<PointWithDistance<L>> heap, int k, Vector pnt, List<LabeledVector<L>> dataPnts, DistanceMeasure distanceMeasure)
k
or a distance from
taget point to data point is less than a distance from target point to the most distant data point in heap).L
- Label type.heap
- Heap with closest points.k
- Number of neighbours.pnt
- Point to calculate distance to.dataPnts
- Data points to be added.distanceMeasure
- Distance measure.
GridGain In-Memory Computing Platform : ver. 8.9.14 Release Date : November 5 2024