diff --git a/html/01_distance_between_points.html b/html/01_distance_between_points.html index 0cd2aed..a46d63c 100644 --- a/html/01_distance_between_points.html +++ b/html/01_distance_between_points.html @@ -1638,28 +1638,28 @@
bbox = st_bbox(c(xmin = 0, xmax = 1, ymax = 0, ymin = 1))
bbox = st_as_sfc(bbox)
-n = 8000
+n = 10000
pts = st_sample(bbox, n)
system.time({
m1 = st_distance(pts, which = "Euclidean")
})
## user system elapsed
-## 2.53 0.20 2.73
+## 1.18 0.19 1.36
system.time({
df = st_coordinates(pts)
m2 = Rfast::Dist(df, method = "euclidean")
})
## user system elapsed
-## 0.40 0.05 0.45
+## 0.55 0.18 0.72
all(m1 == m2)
## [1] TRUE
m1[1:5, 1:5]
-## 1 2 3 4 5
-## 1 0.0000000 0.1066168 0.7185182 0.7058747 0.5910929
-## 2 0.1066168 0.0000000 0.6803274 0.6106702 0.6124067
-## 3 0.7185182 0.6803274 0.0000000 0.4902320 0.3762861
-## 4 0.7058747 0.6106702 0.4902320 0.0000000 0.7659294
-## 5 0.5910929 0.6124067 0.3762861 0.7659294 0.0000000
+## 1 2 3 4 5
+## 1 0.00000000 0.6211186 0.7377293 0.6443854 0.06633203
+## 2 0.62111859 0.0000000 0.2091530 0.7790792 0.65260806
+## 3 0.73772930 0.2091530 0.0000000 0.7084691 0.78236784
+## 4 0.64438539 0.7790792 0.7084691 0.0000000 0.70947711
+## 5 0.06633203 0.6526081 0.7823678 0.7094771 0.00000000
diff --git a/notebooks/01_distance_between_points.Rmd b/notebooks/01_distance_between_points.Rmd
index 0c0cc9c..13b4665 100644
--- a/notebooks/01_distance_between_points.Rmd
+++ b/notebooks/01_distance_between_points.Rmd
@@ -24,7 +24,7 @@ set.seed(1)
```{r}
bbox = st_bbox(c(xmin = 0, xmax = 1, ymax = 0, ymin = 1))
bbox = st_as_sfc(bbox)
-n = 8000
+n = 10000
pts = st_sample(bbox, n)
```