@thi.ng/distance
Advanced tools
Comparing version 2.0.0 to 2.0.1
import type { Fn, NumericArray } from "@thi.ng/api"; | ||
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import type { IDistance, Metric } from "./api"; | ||
import type { IDistance, Metric } from "./api.js"; | ||
/** | ||
@@ -5,0 +5,0 @@ * Takes a vector `p`, array of `samples` and a `dist`ance function. Computes |
import { isFunction } from "@thi.ng/checks/is-function"; | ||
import { knearest } from "./knearest"; | ||
import { DIST_SQ, DIST_SQ1 } from "./squared"; | ||
import { knearest } from "./knearest.js"; | ||
import { DIST_SQ, DIST_SQ1 } from "./squared.js"; | ||
/** | ||
@@ -5,0 +5,0 @@ * Takes a vector `p`, array of `samples` and a `dist`ance function. Computes |
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/distance@2.0.0...@thi.ng/distance@2.0.1) (2021-10-13) | ||
**Note:** Version bump only for package @thi.ng/distance | ||
# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/distance@1.0.7...@thi.ng/distance@2.0.0) (2021-10-12) | ||
@@ -8,0 +16,0 @@ |
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import type { IDistance, Metric } from "./api"; | ||
import type { IDistance, Metric } from "./api.js"; | ||
export declare class Eucledian<T> implements IDistance<T> { | ||
@@ -4,0 +4,0 @@ readonly metric: Metric<T>; |
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import { Eucledian } from "./eucledian"; | ||
import { Eucledian } from "./eucledian.js"; | ||
/** | ||
@@ -4,0 +4,0 @@ * Distance metric for geo locations given as [lat,lon] vectors. |
import { distHaversineLatLon, distHaversineLonLat, } from "@thi.ng/vectors/dist-haversine"; | ||
import { Eucledian } from "./eucledian"; | ||
import { Eucledian } from "./eucledian.js"; | ||
/** | ||
@@ -4,0 +4,0 @@ * Distance metric for geo locations given as [lat,lon] vectors. |
@@ -1,9 +0,9 @@ | ||
export * from "./api"; | ||
export * from "./argmin"; | ||
export * from "./eucledian"; | ||
export * from "./haversine"; | ||
export * from "./knearest"; | ||
export * from "./manhattan"; | ||
export * from "./nearest"; | ||
export * from "./squared"; | ||
export * from "./api.js"; | ||
export * from "./argmin.js"; | ||
export * from "./eucledian.js"; | ||
export * from "./haversine.js"; | ||
export * from "./knearest.js"; | ||
export * from "./manhattan.js"; | ||
export * from "./nearest.js"; | ||
export * from "./squared.js"; | ||
//# sourceMappingURL=index.d.ts.map |
16
index.js
@@ -1,8 +0,8 @@ | ||
export * from "./api"; | ||
export * from "./argmin"; | ||
export * from "./eucledian"; | ||
export * from "./haversine"; | ||
export * from "./knearest"; | ||
export * from "./manhattan"; | ||
export * from "./nearest"; | ||
export * from "./squared"; | ||
export * from "./api.js"; | ||
export * from "./argmin.js"; | ||
export * from "./eucledian.js"; | ||
export * from "./haversine.js"; | ||
export * from "./knearest.js"; | ||
export * from "./manhattan.js"; | ||
export * from "./nearest.js"; | ||
export * from "./squared.js"; |
import type { IDeref } from "@thi.ng/api"; | ||
import { Heap } from "@thi.ng/heaps/heap"; | ||
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import type { IDistance, INeighborhood, Neighbor } from "./api"; | ||
import type { IDistance, INeighborhood, Neighbor } from "./api.js"; | ||
/** | ||
@@ -59,3 +59,3 @@ * A {@link INeighborhood} implementation for K-nearest neighbor queries around | ||
*/ | ||
export declare const knearest: <T>(p: ReadonlyVec, k: number, r?: number | undefined, dist?: import("./squared").Squared<ReadonlyVec>, sorted?: boolean | undefined) => KNearest<ReadonlyVec, T>; | ||
export declare const knearest: <T>(p: ReadonlyVec, k: number, r?: number | undefined, dist?: import("./squared.js").Squared<ReadonlyVec>, sorted?: boolean | undefined) => KNearest<ReadonlyVec, T>; | ||
/** | ||
@@ -71,3 +71,3 @@ * Defines a {@link KNearest} instance for 2D vector positions and, by default, | ||
*/ | ||
export declare const knearest2: <T>(p: ReadonlyVec, k: number, r?: number | undefined, dist?: import("./squared").Squared<ReadonlyVec>, sorted?: boolean | undefined) => KNearest<ReadonlyVec, T>; | ||
export declare const knearest2: <T>(p: ReadonlyVec, k: number, r?: number | undefined, dist?: import("./squared.js").Squared<ReadonlyVec>, sorted?: boolean | undefined) => KNearest<ReadonlyVec, T>; | ||
/** | ||
@@ -83,3 +83,3 @@ * Defines a {@link KNearest} instance for 3D vector positions, by default, | ||
*/ | ||
export declare const knearest3: <T>(p: ReadonlyVec, k: number, r?: number | undefined, dist?: import("./squared").Squared<ReadonlyVec>, sorted?: boolean | undefined) => KNearest<ReadonlyVec, T>; | ||
export declare const knearest3: <T>(p: ReadonlyVec, k: number, r?: number | undefined, dist?: import("./squared.js").Squared<ReadonlyVec>, sorted?: boolean | undefined) => KNearest<ReadonlyVec, T>; | ||
/** | ||
@@ -95,3 +95,3 @@ * Defines a {@link KNearest} instance for numeric positions and, by default, | ||
*/ | ||
export declare const knearestN: <T>(p: number, k: number, r?: number | undefined, dist?: import("./squared").Squared<number>, sorted?: boolean | undefined) => KNearest<number, T>; | ||
export declare const knearestN: <T>(p: number, k: number, r?: number | undefined, dist?: import("./squared.js").Squared<number>, sorted?: boolean | undefined) => KNearest<number, T>; | ||
//# sourceMappingURL=knearest.d.ts.map |
import { assert } from "@thi.ng/errors/assert"; | ||
import { Heap } from "@thi.ng/heaps/heap"; | ||
import { clamp0 } from "@thi.ng/math/interval"; | ||
import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared"; | ||
import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared.js"; | ||
/** | ||
@@ -6,0 +6,0 @@ * A {@link INeighborhood} implementation for K-nearest neighbor queries around |
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import type { IDistance, Metric } from "./api"; | ||
import type { IDistance, Metric } from "./api.js"; | ||
/** | ||
@@ -4,0 +4,0 @@ * Manhattan distance metric and conversion to/from Eucledian distances. |
import type { IDeref } from "@thi.ng/api"; | ||
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import type { IDistance, INeighborhood, Neighbor } from "./api"; | ||
import type { IDistance, INeighborhood, Neighbor } from "./api.js"; | ||
/** | ||
@@ -37,3 +37,3 @@ * A {@link INeighborhood} implementation for nearest neighbor queries around a | ||
*/ | ||
export declare const nearest: <T>(p: ReadonlyVec, r?: number | undefined, dist?: import("./squared").Squared<ReadonlyVec>) => Nearest<ReadonlyVec, T>; | ||
export declare const nearest: <T>(p: ReadonlyVec, r?: number | undefined, dist?: import("./squared.js").Squared<ReadonlyVec>) => Nearest<ReadonlyVec, T>; | ||
/** | ||
@@ -47,3 +47,3 @@ * Defines a {@link Nearest} instance for 2D vector positions, by default, | ||
*/ | ||
export declare const nearest2: <T>(p: ReadonlyVec, r?: number | undefined, dist?: import("./squared").Squared<ReadonlyVec>) => Nearest<ReadonlyVec, T>; | ||
export declare const nearest2: <T>(p: ReadonlyVec, r?: number | undefined, dist?: import("./squared.js").Squared<ReadonlyVec>) => Nearest<ReadonlyVec, T>; | ||
/** | ||
@@ -57,3 +57,3 @@ * Defines a {@link Nearest} instance for 3D vector positions, by default, | ||
*/ | ||
export declare const nearest3: <T>(p: ReadonlyVec, r?: number | undefined, dist?: import("./squared").Squared<ReadonlyVec>) => Nearest<ReadonlyVec, T>; | ||
export declare const nearest3: <T>(p: ReadonlyVec, r?: number | undefined, dist?: import("./squared.js").Squared<ReadonlyVec>) => Nearest<ReadonlyVec, T>; | ||
/** | ||
@@ -67,3 +67,3 @@ * Defines a {@link Nearest} instance for numeric positions and, by default, | ||
*/ | ||
export declare const nearestN: <T>(p: number, r?: number | undefined, dist?: import("./squared").Squared<number>) => Nearest<number, T>; | ||
export declare const nearestN: <T>(p: number, r?: number | undefined, dist?: import("./squared.js").Squared<number>) => Nearest<number, T>; | ||
//# sourceMappingURL=nearest.d.ts.map |
import { clamp0 } from "@thi.ng/math/interval"; | ||
import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared"; | ||
import { DIST_SQ, DIST_SQ1, DIST_SQ2, DIST_SQ3 } from "./squared.js"; | ||
/** | ||
@@ -4,0 +4,0 @@ * A {@link INeighborhood} implementation for nearest neighbor queries around a |
{ | ||
"name": "@thi.ng/distance", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "N-dimensional distance metrics & K-nearest neighborhoods for point queries", | ||
@@ -37,11 +37,11 @@ "type": "module", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.0.0", | ||
"@thi.ng/checks": "^3.0.0", | ||
"@thi.ng/errors": "^2.0.0", | ||
"@thi.ng/heaps": "^2.0.0", | ||
"@thi.ng/math": "^5.0.0", | ||
"@thi.ng/vectors": "^7.0.0" | ||
"@thi.ng/api": "^8.0.1", | ||
"@thi.ng/checks": "^3.0.1", | ||
"@thi.ng/errors": "^2.0.1", | ||
"@thi.ng/heaps": "^2.0.1", | ||
"@thi.ng/math": "^5.0.1", | ||
"@thi.ng/vectors": "^7.0.1" | ||
}, | ||
"devDependencies": { | ||
"@thi.ng/testament": "^0.1.0" | ||
"@thi.ng/testament": "^0.1.1" | ||
}, | ||
@@ -64,2 +64,5 @@ "keywords": [ | ||
}, | ||
"engines": { | ||
"node": ">=12.7" | ||
}, | ||
"files": [ | ||
@@ -106,3 +109,3 @@ "*.js", | ||
}, | ||
"gitHead": "9ac1344b38b565eb894306fbf72233b6c0b2d115" | ||
"gitHead": "2e6b3d7c0f4c5686c1e9bdb4902ed7d3f90bcc19" | ||
} |
@@ -113,6 +113,7 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
For NodeJS (v14.6+): | ||
For Node.js REPL: | ||
```text | ||
node --experimental-specifier-resolution=node --experimental-repl-await | ||
# with flag only for < v16 | ||
node --experimental-repl-await | ||
@@ -119,0 +120,0 @@ > const distance = await import("@thi.ng/distance"); |
import type { ReadonlyVec } from "@thi.ng/vectors"; | ||
import type { IDistance, Metric } from "./api"; | ||
import type { IDistance, Metric } from "./api.js"; | ||
export declare class Squared<T> implements IDistance<T> { | ||
@@ -4,0 +4,0 @@ readonly metric: Metric<T>; |
51397
183
Updated@thi.ng/api@^8.0.1
Updated@thi.ng/checks@^3.0.1
Updated@thi.ng/errors@^2.0.1
Updated@thi.ng/heaps@^2.0.1
Updated@thi.ng/math@^5.0.1
Updated@thi.ng/vectors@^7.0.1