@thi.ng/distance 2.4.27 → 2.4.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/README.md +1 -1
- package/eucledian.js +1 -0
- package/knearest.js +9 -3
- package/manhattan.js +3 -0
- package/nearest.js +5 -0
- package/package.json +13 -14
- package/radial.js +5 -0
- package/squared.js +1 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/eucledian.js
CHANGED
package/knearest.js
CHANGED
|
@@ -19,15 +19,21 @@ import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared.js";
|
|
|
19
19
|
* @typeParam T - indexed value
|
|
20
20
|
*/
|
|
21
21
|
export class KNearest {
|
|
22
|
+
dist;
|
|
23
|
+
target;
|
|
24
|
+
k;
|
|
25
|
+
radius;
|
|
26
|
+
sorted;
|
|
27
|
+
_currR;
|
|
28
|
+
_heap = new Heap(null, {
|
|
29
|
+
compare: (a, b) => b[0] - a[0],
|
|
30
|
+
});
|
|
22
31
|
constructor(dist, target, k, radius = Infinity, sorted = false) {
|
|
23
32
|
this.dist = dist;
|
|
24
33
|
this.target = target;
|
|
25
34
|
this.k = k;
|
|
26
35
|
this.radius = radius;
|
|
27
36
|
this.sorted = sorted;
|
|
28
|
-
this._heap = new Heap(null, {
|
|
29
|
-
compare: (a, b) => b[0] - a[0],
|
|
30
|
-
});
|
|
31
37
|
this.radius = clamp0(radius);
|
|
32
38
|
this.setK(k);
|
|
33
39
|
}
|
package/manhattan.js
CHANGED
package/nearest.js
CHANGED
|
@@ -9,6 +9,11 @@ import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared.js";
|
|
|
9
9
|
* @typeParam T - indexed value
|
|
10
10
|
*/
|
|
11
11
|
export class Nearest {
|
|
12
|
+
dist;
|
|
13
|
+
target;
|
|
14
|
+
radius;
|
|
15
|
+
_currR;
|
|
16
|
+
value;
|
|
12
17
|
constructor(dist, target, radius = Infinity) {
|
|
13
18
|
this.dist = dist;
|
|
14
19
|
this.target = target;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/distance",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.29",
|
|
4
4
|
"description": "N-dimensional distance metrics & K-nearest neighborhoods for point queries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -28,25 +28,24 @@
|
|
|
28
28
|
"clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
|
|
29
29
|
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
30
|
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
31
|
-
"doc:readme": "
|
|
32
|
-
"doc:stats": "tools:module-stats",
|
|
31
|
+
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
33
32
|
"pub": "yarn npm publish --access public",
|
|
34
|
-
"test": "
|
|
33
|
+
"test": "bun test"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.9.
|
|
38
|
-
"@thi.ng/checks": "^3.4.
|
|
39
|
-
"@thi.ng/errors": "^2.4.
|
|
40
|
-
"@thi.ng/heaps": "^2.1.
|
|
41
|
-
"@thi.ng/math": "^5.7.
|
|
42
|
-
"@thi.ng/vectors": "^7.8.
|
|
36
|
+
"@thi.ng/api": "^8.9.8",
|
|
37
|
+
"@thi.ng/checks": "^3.4.8",
|
|
38
|
+
"@thi.ng/errors": "^2.4.2",
|
|
39
|
+
"@thi.ng/heaps": "^2.1.44",
|
|
40
|
+
"@thi.ng/math": "^5.7.3",
|
|
41
|
+
"@thi.ng/vectors": "^7.8.4"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@microsoft/api-extractor": "^7.38.
|
|
46
|
-
"@thi.ng/testament": "^0.
|
|
44
|
+
"@microsoft/api-extractor": "^7.38.2",
|
|
45
|
+
"@thi.ng/testament": "^0.4.1",
|
|
47
46
|
"rimraf": "^5.0.5",
|
|
48
47
|
"tools": "^0.0.1",
|
|
49
|
-
"typedoc": "^0.25.
|
|
48
|
+
"typedoc": "^0.25.3",
|
|
50
49
|
"typescript": "^5.2.2"
|
|
51
50
|
},
|
|
52
51
|
"keywords": [
|
|
@@ -112,5 +111,5 @@
|
|
|
112
111
|
],
|
|
113
112
|
"year": 2021
|
|
114
113
|
},
|
|
115
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "669a3151e4302480244fe3e60eff5e732ea5b7a7\n"
|
|
116
115
|
}
|
package/radial.js
CHANGED
|
@@ -14,6 +14,11 @@ import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared.js";
|
|
|
14
14
|
* @typeParam T - indexed value
|
|
15
15
|
*/
|
|
16
16
|
export class Radial {
|
|
17
|
+
dist;
|
|
18
|
+
target;
|
|
19
|
+
radius;
|
|
20
|
+
_r;
|
|
21
|
+
_items;
|
|
17
22
|
constructor(dist, target, radius = Infinity) {
|
|
18
23
|
this.dist = dist;
|
|
19
24
|
this.target = target;
|