Package elki.math.spacefillingcurves
Class ZCurveSpatialSorter
- java.lang.Object
-
- elki.math.spacefillingcurves.ZCurveSpatialSorter
-
- All Implemented Interfaces:
SpatialSorter
public class ZCurveSpatialSorter extends java.lang.Object implements SpatialSorter
Class to sort the data set by their Z-index, without doing a full materialization of the Z indexes.- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ZCurveSpatialSorter.Par
Parameterization class.
-
Field Summary
Fields Modifier and Type Field Description static ZCurveSpatialSorter
STATIC
Static instance.private static double
STOPVAL
Stopping threshold.
-
Constructor Summary
Constructors Constructor Description ZCurveSpatialSorter()
Constructor, useSTATIC
instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static double
getMinPlusMaxObject(java.util.List<? extends SpatialComparable> objs, int s, int dim)
Compute getMin(dim) + getMax(dim) for the spatial object.protected static int
pivotizeList1D(java.util.List<? extends SpatialComparable> objs, int start, int end, int dim, double threshold, boolean desc)
"Pivotize" the list, such that all elements before the given position are less than, all elements after the position are larger than the threshold value in the given dimension.void
sort(java.util.List<? extends SpatialComparable> objs, int start, int end, double[] minmax, int[] dims)
Sort part of the list (start to end).protected void
zSort(java.util.List<? extends SpatialComparable> objs, int start, int end, double[] mms, int[] dims, int depth)
The actual Z sorting function-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.math.spacefillingcurves.SpatialSorter
sort
-
-
-
-
Field Detail
-
STATIC
public static final ZCurveSpatialSorter STATIC
Static instance.
-
STOPVAL
private static final double STOPVAL
Stopping threshold.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ZCurveSpatialSorter
public ZCurveSpatialSorter()
Constructor, useSTATIC
instead.
-
-
Method Detail
-
sort
public void sort(java.util.List<? extends SpatialComparable> objs, int start, int end, double[] minmax, int[] dims)
Description copied from interface:SpatialSorter
Sort part of the list (start to end).- Specified by:
sort
in interfaceSpatialSorter
- Parameters:
objs
- the spatial objects to be sortedstart
- First index to sort (e.g., 0)end
- End of range (e.g.,site()
)minmax
- Array with dim pairs of (min, max) of value rangesdims
- Dimensions to sort by, for indexing vectors andminmax
.
-
zSort
protected void zSort(java.util.List<? extends SpatialComparable> objs, int start, int end, double[] mms, int[] dims, int depth)
The actual Z sorting function- Parameters:
objs
- Objects to sortstart
- Startend
- Endmms
- Min-Max value rangesdims
- Dimensions to processdepth
- Current dimension
-
pivotizeList1D
protected static int pivotizeList1D(java.util.List<? extends SpatialComparable> objs, int start, int end, int dim, double threshold, boolean desc)
"Pivotize" the list, such that all elements before the given position are less than, all elements after the position are larger than the threshold value in the given dimension. (desc inverts the sorting!) Only the elements in the interval [start: end[ are sorted!- Parameters:
objs
- List of objectsstart
- Start of sorting rangeend
- End of sorting rangedim
- Dimension to sort bythreshold
- Threshold valuedesc
- Inversion flag- Returns:
- Pivot position
-
getMinPlusMaxObject
private static double getMinPlusMaxObject(java.util.List<? extends SpatialComparable> objs, int s, int dim)
Compute getMin(dim) + getMax(dim) for the spatial object.- Parameters:
objs
- Objectss
- indexdim
- Dimensionality- Returns:
- Min+Max
-
-