KType keys.
Learns a mapping that returns a position for a KType key which is at most epsilon
away from the correct one in a sorted list of keys. It is optimal and piecewise because it learns
the minimum number of epsilon-approximate segments.
The PLA-model consists of a sequence segments. A segment s is a triple (key,slope,intercept) that indexes a range of keys through the function fs(k) = k × slope + intercept, which provides an epsilon-approximation of the position of the key k.
| Modifier and Type | Class and Description |
|---|---|
| private static class | PlaModel.
Re-usable mutable (x,y) point. |
| private static class | PlaModel.
List of mutable |
| public static interface | PlaModel.
Consumer notified when a new segment is built by the |
| private static class | PlaModel.
Re-usable mutable (dx,dy) slope. |
| Modifier and Type | Field and Description |
|---|---|
| private int | epsilon
Epsilon precision of the PLA-model. |
| private double | firstKey
First key of the current segment. |
| private static final int | INITIAL_CAPACITY
Initial capacity of the lower and upper point lists. |
| private final PlaModel. | lower
Ordered list of lower points for the current segment. |
| private int | lowerStart
Index of the first lower point to compare to. |
| private int | numPointsInHull
Number of points in the convex hull for the current segment. |
| private final PlaModel. | |
| private final PlaModel. | |
| private double | previousKey
Previous key used to check that keys are added in strictly increasing sequence. |
| private final PlaModel. | rect
Enclosing rectangle for the current segment. |
| private final PlaModel. | |
| private final PlaModel. | |
| private final PlaModel. | |
| private final PlaModel. | |
| private final PlaModel. | |
| private final PlaModel. | upper
Ordered list of upper points for the current segment. |
| private int | upperStart
Index of the first upper point to compare to. |
| Access | Constructor and Description |
|---|---|
| public | PlaModel(int
must be greater than or equal to 0. epsilon)Creates an optimal PLA-model with the provided epsilon precision. |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public void | addKey(double key, int
The index of the key in the sorted key list. index, PlaModel.The consumer to call when a new segment is built in the PLA-model. segmentConsumerAdds a key to this PLA-model. |
| private static double | |
| public void | |
| private void | |
| public long | ramBytesAllocated()
Implements com. Allocated memory estimation |
| public long | ramBytesUsed()
Implements com. Bytes that is actually been used |
| private void | |
| public void | |
| private int |
| epsilon | back to summary |
|---|---|
| private int epsilon Epsilon precision of the PLA-model. | |
| firstKey | back to summary |
|---|---|
| private double firstKey First key of the current segment. | |
| INITIAL_CAPACITY | back to summary |
|---|---|
| private static final int INITIAL_CAPACITY Initial capacity of the lower and upper point lists. | |
| lower | back to summary |
|---|---|
| private final PlaModel. Ordered list of lower points for the current segment. Inside the list, allocated points are re-used. | |
| lowerStart | back to summary |
|---|---|
| private int lowerStart Index of the first lower point to compare to. | |
| numPointsInHull | back to summary |
|---|---|
| private int numPointsInHull Number of points in the convex hull for the current segment. | |
| point1 | back to summary |
|---|---|
| private final PlaModel. | |
| point2 | back to summary |
|---|---|
| private final PlaModel. | |
| previousKey | back to summary |
|---|---|
| private double previousKey Previous key used to check that keys are added in strictly increasing sequence. | |
| rect | back to summary |
|---|---|
| private final PlaModel. Enclosing rectangle for the current segment. | |
| slope1 | back to summary |
|---|---|
| private final PlaModel. | |
| slope2 | back to summary |
|---|---|
| private final PlaModel. | |
| slopeMax | back to summary |
|---|---|
| private final PlaModel. | |
| slopeMin | back to summary |
|---|---|
| private final PlaModel. | |
| slopeTmp | back to summary |
|---|---|
| private final PlaModel. | |
| upper | back to summary |
|---|---|
| private final PlaModel. Ordered list of upper points for the current segment. Inside the list, allocated points are re-used. | |
| upperStart | back to summary |
|---|---|
| private int upperStart Index of the first upper point to compare to. | |
| PlaModel | back to summary |
|---|---|
| public PlaModel(int epsilon) Creates an optimal PLA-model with the provided epsilon precision.
| |
| addEpsilon | back to summary |
|---|---|
| private int addEpsilon(int index) | |
| addKey | back to summary |
|---|---|
| public void addKey(double key, int index, PlaModel. Adds a key to this PLA-model. The keys must be provided in a strictly increasing sequence. That is, the key must be greater than the previous key.
| |
| cross | back to summary |
|---|---|
| private static double cross(PlaModel. | |
| finish | back to summary |
|---|---|
| public void finish(PlaModel. Finishes the PLA-model construction. Declares that no additional keys will be added. Builds the
last segment and calls the provided | |
| produceSegment | back to summary |
|---|---|
| private void produceSegment(PlaModel. | |
| ramBytesAllocated | back to summary |
|---|---|
| public long ramBytesAllocated() Implements com. Doc from com. Allocated memory estimation
| |
| ramBytesUsed | back to summary |
|---|---|
| public long ramBytesUsed() Implements com. Doc from com. Bytes that is actually been used
| |
| reset | back to summary |
|---|---|
| private void reset() | |
| setEpsilon | back to summary |
|---|---|
| public void setEpsilon(int epsilon) Sets epsilon precision which must be greater than or equal to 0. | |
| subtractEpsilon | back to summary |
|---|---|
| private int subtractEpsilon(int index) | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final int | |
| pack-priv double | |
| pack-priv long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv PlaModel. | |
| pack-priv PlaModel. |
| RAM_BYTES_ALLOCATED | back to summary |
|---|---|
| pack-priv static final int RAM_BYTES_ALLOCATED | |
| x | back to summary |
|---|---|
| pack-priv double x | |
| y | back to summary |
|---|---|
| pack-priv long y | |
| Point | back to summary |
|---|---|
| private Point() | |
| set | back to summary |
|---|---|
| pack-priv PlaModel. | |
| set | back to summary |
|---|---|
| pack-priv PlaModel. | |
Point. Re-uses allocated points instead of creating new instances.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv PlaModel. | |
| pack-priv int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv PlaModel. | |
| public long | ramBytesAllocated()
Implements com. Allocated memory estimation |
| public long | ramBytesUsed()
Implements com. Bytes that is actually been used |
| pack-priv int |
| numAllocated | back to summary |
|---|---|
| pack-priv int numAllocated | |
| points | back to summary |
|---|---|
| pack-priv PlaModel. | |
| size | back to summary |
|---|---|
| pack-priv int size | |
| PointList | back to summary |
|---|---|
| pack-priv PointList(int initialCapacity) | |
| add | back to summary |
|---|---|
| pack-priv void add(PlaModel. | |
| clear | back to summary |
|---|---|
| pack-priv void clear() | |
| clearFrom | back to summary |
|---|---|
| pack-priv void clearFrom(int end) | |
| get | back to summary |
|---|---|
| pack-priv PlaModel. | |
| ramBytesAllocated | back to summary |
|---|---|
| public long ramBytesAllocated() Implements com. Doc from com. Allocated memory estimation
| |
| ramBytesUsed | back to summary |
|---|---|
| public long ramBytesUsed() Implements com. Doc from com. Bytes that is actually been used
| |
| size | back to summary |
|---|---|
| pack-priv int size() | |
PlaModel.
| Modifier and Type | Method and Description |
|---|---|
| public void | accept(double
The first key of the segment. firstKey, double The segment slope. slope, long The segment intercept. intercept)Consumes a new segment. |
| accept | back to summary |
|---|---|
| public void accept(double firstKey, double slope, long intercept) Consumes a new segment. The segment is defined by the epsilon-approximation function fs(k) = k × slope + intercept.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv double | |
| pack-priv long | |
| pack-priv static final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static double | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv PlaModel. |
| dx | back to summary |
|---|---|
| pack-priv double dx | |
| dy | back to summary |
|---|---|
| pack-priv long dy | |
| RAM_BYTES_ALLOCATED | back to summary |
|---|---|
| pack-priv static final int RAM_BYTES_ALLOCATED | |
| Slope | back to summary |
|---|---|
| private Slope() | |
| asDouble | back to summary |
|---|---|
| pack-priv static double asDouble(PlaModel. | |
| isEqual | back to summary |
|---|---|
| pack-priv boolean isEqual(PlaModel. | |
| isGreaterThan | back to summary |
|---|---|
| pack-priv boolean isGreaterThan(PlaModel. | |
| isLessThan | back to summary |
|---|---|
| pack-priv boolean isLessThan(PlaModel. | |
| set | back to summary |
|---|---|
| pack-priv void set(PlaModel. | |
| set | back to summary |
|---|---|
| pack-priv PlaModel. | |