You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DistanceFunction used by Mtree in this project returns a double-precision number. However, double-precision numbers will lose precision when calculated, which will cause some bugs. For example, some index items will not be deleted, as shown below.
public static void main(String[] args) throws Exception {
MTree tree = new MTree<>(4, Point::distancePoint, null);
Queue queue = new LinkedList<>();
File f = new File("test.txt");
BufferedReader br = new BufferedReader(new FileReader(f));
String line;
int count = 0;
while ((line = br.readLine()) != null){
String[] split = line.split("\t");
TrackPoint point = new TrackPoint(new double[]{Double.parseDouble(split[1]), Double.parseDouble(split[2])},
Long.parseLong(split[3]),
Integer.parseInt(split[0]));
tree.insert(point);
queue.add(point);
count++;
if (count % 40 == 0){
if (count > 20000){
for (int i = 0; i < 40; i++) {
TrackPoint trackPoint = queue.remove();
if (count == 36480 && i == 17)
tree.search(trackPoint, 1.0);
if (!tree.delete(trackPoint))
System.out.print("");
}
}
}
}
}
class TrackPoint {
public double[] data;
public long timestamp;
public int TID;
public TrackPoint(double[] data, long timestamp, int TID) {
super(data);
this.timestamp = timestamp;
this.TID = TID;
}
We implement this repo to support static dataset, in which delete will not happen. I recognize the precision issue, but we probably will not fix it due to the purpose of the code.
DistanceFunction used by Mtree in this project returns a double-precision number. However, double-precision numbers will lose precision when calculated, which will cause some bugs. For example, some index items will not be deleted, as shown below.
public static void main(String[] args) throws Exception {
MTree tree = new MTree<>(4, Point::distancePoint, null);
Queue queue = new LinkedList<>();
File f = new File("test.txt");
BufferedReader br = new BufferedReader(new FileReader(f));
String line;
int count = 0;
while ((line = br.readLine()) != null){
String[] split = line.split("\t");
TrackPoint point = new TrackPoint(new double[]{Double.parseDouble(split[1]), Double.parseDouble(split[2])},
Long.parseLong(split[3]),
Integer.parseInt(split[0]));
tree.insert(point);
queue.add(point);
count++;
if (count % 40 == 0){
if (count > 20000){
for (int i = 0; i < 40; i++) {
TrackPoint trackPoint = queue.remove();
if (count == 36480 && i == 17)
tree.search(trackPoint, 1.0);
if (!tree.delete(trackPoint))
System.out.print("");
}
class TrackPoint {
public double[] data;
public long timestamp;
public int TID;
}
test.txt
The text was updated successfully, but these errors were encountered: