@ac-kit/math-stats 0.2.3 → 0.3.0
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 +44 -0
- package/README.md +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/kmeans.d.ts.map +1 -1
- package/dist/kmeans.js +3 -2
- package/dist/kmeans.js.map +1 -1
- package/dist/sliding-median.d.ts +70 -0
- package/dist/sliding-median.d.ts.map +1 -0
- package/dist/sliding-median.js +147 -0
- package/dist/sliding-median.js.map +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5152230: `SlidingMedian`: exact median of the last `n` values pushed, allocation-free
|
|
8
|
+
after construction. `pushFrom(source, index)` and `selectInto(output, index,
|
|
9
|
+
rank)` are the slot forms for per-frame callers (`median()` and `select()`
|
|
10
|
+
return a double that V8 may box); they throw `RangeError` on a bad index.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [2a0fe74]
|
|
15
|
+
- Updated dependencies [5152230]
|
|
16
|
+
- Updated dependencies [5152230]
|
|
17
|
+
- Updated dependencies [2a0fe74]
|
|
18
|
+
- Updated dependencies [5152230]
|
|
19
|
+
- Updated dependencies [2a0fe74]
|
|
20
|
+
- Updated dependencies [5152230]
|
|
21
|
+
- Updated dependencies [5152230]
|
|
22
|
+
- Updated dependencies [2a0fe74]
|
|
23
|
+
- Updated dependencies [2a0fe74]
|
|
24
|
+
- Updated dependencies [5152230]
|
|
25
|
+
- Updated dependencies [5152230]
|
|
26
|
+
- Updated dependencies [5152230]
|
|
27
|
+
- Updated dependencies [5152230]
|
|
28
|
+
- Updated dependencies [5152230]
|
|
29
|
+
- Updated dependencies [5152230]
|
|
30
|
+
- Updated dependencies [5152230]
|
|
31
|
+
- Updated dependencies [5152230]
|
|
32
|
+
- @ac-kit/algo@0.4.0
|
|
33
|
+
- @ac-kit/core@0.10.0
|
|
34
|
+
- @ac-kit/math-analysis@0.1.9
|
|
35
|
+
- @ac-kit/math-scalar@0.2.2
|
|
36
|
+
|
|
37
|
+
## 0.2.4
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [20341eb]
|
|
42
|
+
- @ac-kit/core@0.9.0
|
|
43
|
+
- @ac-kit/algo@0.3.2
|
|
44
|
+
- @ac-kit/math-analysis@0.1.8
|
|
45
|
+
- @ac-kit/math-scalar@0.2.1
|
|
46
|
+
|
|
3
47
|
## 0.2.3
|
|
4
48
|
|
|
5
49
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -35,6 +35,19 @@ The three means answer different questions and are not interchangeable:
|
|
|
35
35
|
They satisfy `harmonic ≤ geometric ≤ arithmetic` for positive values, with
|
|
36
36
|
equality only when every value is identical.
|
|
37
37
|
|
|
38
|
+
## Sliding windows
|
|
39
|
+
|
|
40
|
+
`SlidingMedian` keeps the exact median of the last `n` values pushed, without
|
|
41
|
+
allocating after construction — for adaptive thresholds over a per-frame signal.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { SlidingMedian } from "@ac-kit/math-stats";
|
|
45
|
+
|
|
46
|
+
const recent = new SlidingMedian(38);
|
|
47
|
+
recent.push(sample);
|
|
48
|
+
const threshold = recent.median() * 1.5;
|
|
49
|
+
```
|
|
50
|
+
|
|
38
51
|
## Distributions
|
|
39
52
|
|
|
40
53
|
Every family is a factory returning a `Distribution` — `density`, `cdf`,
|
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from "./poisson-distribution.js";
|
|
|
25
25
|
export * from "./quantile.js";
|
|
26
26
|
export * from "./random-effects.js";
|
|
27
27
|
export * from "./regression.js";
|
|
28
|
+
export * from "./sliding-median.js";
|
|
28
29
|
export * from "./student-t-distribution.js";
|
|
29
30
|
export * from "./sum.js";
|
|
30
31
|
export * from "./t-test.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export * from "./poisson-distribution.js";
|
|
|
25
25
|
export * from "./quantile.js";
|
|
26
26
|
export * from "./random-effects.js";
|
|
27
27
|
export * from "./regression.js";
|
|
28
|
+
export * from "./sliding-median.js";
|
|
28
29
|
export * from "./student-t-distribution.js";
|
|
29
30
|
export * from "./sum.js";
|
|
30
31
|
export * from "./t-test.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kCAAkC,CAAC;AACjD,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
package/dist/kmeans.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kmeans.d.ts","sourceRoot":"","sources":["../src/kmeans.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kmeans.d.ts","sourceRoot":"","sources":["../src/kmeans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,CAAC;IACtC;;;;;OAKG;IACH,QAAQ,CAAC,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAA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001,
|
|
@@ -84,7 +85,7 @@ export function kmeans(n, k, ops, options) {
|
|
|
84
85
|
.filter((cluster) => cluster.indices.length > 0);
|
|
85
86
|
}
|
|
86
87
|
function kmeansppInit_(n, k, ops, rand) {
|
|
87
|
-
const centroids = [ops.clone(ops.pointValue(
|
|
88
|
+
const centroids = [ops.clone(ops.pointValue(randomInteger(0, n, rand)))];
|
|
88
89
|
while (centroids.length < k) {
|
|
89
90
|
// D²-weighted sampling: probability of picking point i is proportional to its squared
|
|
90
91
|
// distance to the nearest already-chosen centroid.
|
|
@@ -103,7 +104,7 @@ function kmeansppInit_(n, k, ops, rand) {
|
|
|
103
104
|
}
|
|
104
105
|
if (total === 0) {
|
|
105
106
|
// All remaining points coincide with existing centroids — pick any point.
|
|
106
|
-
centroids.push(ops.clone(ops.pointValue(
|
|
107
|
+
centroids.push(ops.clone(ops.pointValue(randomInteger(0, n, rand))));
|
|
107
108
|
continue;
|
|
108
109
|
}
|
|
109
110
|
let remaining = rand() * total;
|
package/dist/kmeans.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kmeans.js","sourceRoot":"","sources":["../src/kmeans.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kmeans.js","sourceRoot":"","sources":["../src/kmeans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAqE7C,MAAM,gBAAgB,GAA4B;IACjD,aAAa,EAAE,GAAG;IAClB,oBAAoB,EAAE,MAAM;IAC5B,MAAM,EAAE,IAAI;CACZ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,MAAM,CACrB,CAAS,EACT,CAAS,EACT,GAAiB,EACjB,OAAuB;IAEvB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEvB,MAAM,IAAI,GAA4B;QACrC,aAAa,EAAE,OAAO,EAAE,aAAa,IAAI,gBAAgB,CAAC,aAA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,CAAC,CAAC;YACzB,KAAK,IAAI,QAAQ,CAAC;QACnB,CAAC;QAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACjB,0EAA0E;YAC1E,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACrE,SAAS;QACV,CAAC;QAED,IAAI,SAAS,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QAC/B,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,SAAS,IAAI,SAAS,CAAC,CAAC,CAAE,CAAC;YAC3B,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;gBACpB,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,MAAM,GAAG,IAAI,CAAC;gBACd,MAAM;YACP,CAAC;QACF,CAAC;QACD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,wDAAwD;YACxD,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAED,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact median of the last `windowLength` values pushed.
|
|
3
|
+
*
|
|
4
|
+
* Keeps the window twice: in arrival order, to know which value expires, and
|
|
5
|
+
* sorted, to read the median. A push removes the expiring value and inserts the
|
|
6
|
+
* new one by binary search and one `copyWithin` each, so it costs
|
|
7
|
+
* `O(windowLength)` memory moves — the cheapest exact choice for the windows of
|
|
8
|
+
* tens to a few hundred values that per-frame audio and sensor code uses — and
|
|
9
|
+
* allocates nothing once constructed.
|
|
10
|
+
*
|
|
11
|
+
* Distinct from the planned `RunningMedian` (two heaps, unbounded history,
|
|
12
|
+
* `O(log n)` insert): this one forgets.
|
|
13
|
+
*/
|
|
14
|
+
export declare class SlidingMedian {
|
|
15
|
+
readonly windowLength: number;
|
|
16
|
+
private readonly arrival_;
|
|
17
|
+
private readonly sorted_;
|
|
18
|
+
private readonly probe_;
|
|
19
|
+
private count_;
|
|
20
|
+
private oldest_;
|
|
21
|
+
/** @throws {RangeError} If `windowLength` is not a positive integer. */
|
|
22
|
+
constructor(windowLength: number);
|
|
23
|
+
/** Number of values currently held, at most {@link windowLength}. */
|
|
24
|
+
get length(): number;
|
|
25
|
+
/**
|
|
26
|
+
* Adds `value`, dropping the oldest one once the window is full.
|
|
27
|
+
*
|
|
28
|
+
* @throws {RangeError} If `value` is NaN; the window is left unchanged.
|
|
29
|
+
*/
|
|
30
|
+
push(value: number): void;
|
|
31
|
+
/**
|
|
32
|
+
* {@link push} of `source[index]`. Per-frame callers that keep their samples
|
|
33
|
+
* in a `Float64Array` use it to avoid passing a double through a call, which
|
|
34
|
+
* V8 boxes into a new heap number whenever the call is not inlined.
|
|
35
|
+
*
|
|
36
|
+
* @throws {RangeError} If `index` is not an integer in `[0, source.length)`
|
|
37
|
+
* or the value is NaN; the window is left unchanged.
|
|
38
|
+
*/
|
|
39
|
+
pushFrom(source: Float64Array, index: number): void;
|
|
40
|
+
/**
|
|
41
|
+
* The median of the values held: the middle one, or the mean of the two
|
|
42
|
+
* middle ones when their number is even. `NaN` while empty.
|
|
43
|
+
*
|
|
44
|
+
* The result is a double returned from a call, which V8 boxes into a heap
|
|
45
|
+
* number when the call is not inlined; a per-frame loop should read it with
|
|
46
|
+
* {@link selectInto} instead.
|
|
47
|
+
*/
|
|
48
|
+
median(): number;
|
|
49
|
+
/**
|
|
50
|
+
* The `rank`-th smallest value held, counting from 0. `select(length >> 1)`
|
|
51
|
+
* is the upper median, the `sorted[n >> 1]` convention. Boxes its result like
|
|
52
|
+
* {@link median}; see {@link selectInto}.
|
|
53
|
+
*
|
|
54
|
+
* @throws {RangeError} If `rank` is not an integer in `[0, length)`.
|
|
55
|
+
*/
|
|
56
|
+
select(rank: number): number;
|
|
57
|
+
/**
|
|
58
|
+
* {@link select} written to `output[index]`, for the same reason as
|
|
59
|
+
* {@link pushFrom}: no double crosses a call.
|
|
60
|
+
*
|
|
61
|
+
* @throws {RangeError} If `index` is not an integer in `[0, output.length)`
|
|
62
|
+
* or `rank` is out of range; `output` is left unchanged.
|
|
63
|
+
*/
|
|
64
|
+
selectInto(output: Float64Array, index: number, rank: number): void;
|
|
65
|
+
/** Forgets every value. */
|
|
66
|
+
reset(): void;
|
|
67
|
+
/** First index in the sorted prefix whose value is not below `probe_[0]`. */
|
|
68
|
+
private lowerBound_;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=sliding-median.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sliding-median.d.ts","sourceRoot":"","sources":["../src/sliding-median.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAa;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,OAAO,CAAK;IAEpB,wEAAwE;IACxE,YAAY,YAAY,EAAE,MAAM,EAU/B;IAED,qEAAqE;IACrE,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGxB;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAyBlD;IAED;;;;;;;OAOG;IACH,MAAM,IAAI,MAAM,CAUf;IAED;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG3B;IAED;;;;;;OAMG;IACH,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CASlE;IAED,2BAA2B;IAC3B,KAAK,IAAI,IAAI,CAGZ;IAED,6EAA6E;IAC7E,OAAO,CAAC,WAAW;CAgBnB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exact median of the last `windowLength` values pushed.
|
|
3
|
+
*
|
|
4
|
+
* Keeps the window twice: in arrival order, to know which value expires, and
|
|
5
|
+
* sorted, to read the median. A push removes the expiring value and inserts the
|
|
6
|
+
* new one by binary search and one `copyWithin` each, so it costs
|
|
7
|
+
* `O(windowLength)` memory moves — the cheapest exact choice for the windows of
|
|
8
|
+
* tens to a few hundred values that per-frame audio and sensor code uses — and
|
|
9
|
+
* allocates nothing once constructed.
|
|
10
|
+
*
|
|
11
|
+
* Distinct from the planned `RunningMedian` (two heaps, unbounded history,
|
|
12
|
+
* `O(log n)` insert): this one forgets.
|
|
13
|
+
*/
|
|
14
|
+
export class SlidingMedian {
|
|
15
|
+
windowLength;
|
|
16
|
+
arrival_;
|
|
17
|
+
sorted_;
|
|
18
|
+
probe_ = new Float64Array(1);
|
|
19
|
+
count_ = 0;
|
|
20
|
+
oldest_ = 0;
|
|
21
|
+
/** @throws {RangeError} If `windowLength` is not a positive integer. */
|
|
22
|
+
constructor(windowLength) {
|
|
23
|
+
if (!Number.isInteger(windowLength) || windowLength < 1) {
|
|
24
|
+
throw new RangeError(`windowLength must be a positive integer, got ${windowLength}`);
|
|
25
|
+
}
|
|
26
|
+
this.windowLength = windowLength;
|
|
27
|
+
this.arrival_ = new Float64Array(windowLength);
|
|
28
|
+
this.sorted_ = new Float64Array(windowLength);
|
|
29
|
+
}
|
|
30
|
+
/** Number of values currently held, at most {@link windowLength}. */
|
|
31
|
+
get length() {
|
|
32
|
+
return this.count_;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Adds `value`, dropping the oldest one once the window is full.
|
|
36
|
+
*
|
|
37
|
+
* @throws {RangeError} If `value` is NaN; the window is left unchanged.
|
|
38
|
+
*/
|
|
39
|
+
push(value) {
|
|
40
|
+
this.probe_[0] = value;
|
|
41
|
+
this.pushFrom(this.probe_, 0);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* {@link push} of `source[index]`. Per-frame callers that keep their samples
|
|
45
|
+
* in a `Float64Array` use it to avoid passing a double through a call, which
|
|
46
|
+
* V8 boxes into a new heap number whenever the call is not inlined.
|
|
47
|
+
*
|
|
48
|
+
* @throws {RangeError} If `index` is not an integer in `[0, source.length)`
|
|
49
|
+
* or the value is NaN; the window is left unchanged.
|
|
50
|
+
*/
|
|
51
|
+
pushFrom(source, index) {
|
|
52
|
+
assertIndex_(source, index);
|
|
53
|
+
const value = source[index];
|
|
54
|
+
if (Number.isNaN(value)) {
|
|
55
|
+
throw new RangeError("cannot push NaN into a sliding median");
|
|
56
|
+
}
|
|
57
|
+
const sorted = this.sorted_;
|
|
58
|
+
const probe = this.probe_;
|
|
59
|
+
if (this.count_ === this.windowLength) {
|
|
60
|
+
probe[0] = this.arrival_[this.oldest_];
|
|
61
|
+
const from = this.lowerBound_(this.count_);
|
|
62
|
+
sorted.copyWithin(from, from + 1, this.count_);
|
|
63
|
+
this.count_--;
|
|
64
|
+
this.arrival_[this.oldest_] = value;
|
|
65
|
+
this.oldest_ = (this.oldest_ + 1) % this.windowLength;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.arrival_[(this.oldest_ + this.count_) % this.windowLength] = value;
|
|
69
|
+
}
|
|
70
|
+
probe[0] = value;
|
|
71
|
+
const at = this.lowerBound_(this.count_);
|
|
72
|
+
sorted.copyWithin(at + 1, at, this.count_);
|
|
73
|
+
sorted[at] = value;
|
|
74
|
+
this.count_++;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The median of the values held: the middle one, or the mean of the two
|
|
78
|
+
* middle ones when their number is even. `NaN` while empty.
|
|
79
|
+
*
|
|
80
|
+
* The result is a double returned from a call, which V8 boxes into a heap
|
|
81
|
+
* number when the call is not inlined; a per-frame loop should read it with
|
|
82
|
+
* {@link selectInto} instead.
|
|
83
|
+
*/
|
|
84
|
+
median() {
|
|
85
|
+
const count = this.count_;
|
|
86
|
+
if (count === 0) {
|
|
87
|
+
return Number.NaN;
|
|
88
|
+
}
|
|
89
|
+
const upper = this.sorted_[count >> 1];
|
|
90
|
+
return count % 2 === 1
|
|
91
|
+
? upper
|
|
92
|
+
: (this.sorted_[(count >> 1) - 1] + upper) / 2;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The `rank`-th smallest value held, counting from 0. `select(length >> 1)`
|
|
96
|
+
* is the upper median, the `sorted[n >> 1]` convention. Boxes its result like
|
|
97
|
+
* {@link median}; see {@link selectInto}.
|
|
98
|
+
*
|
|
99
|
+
* @throws {RangeError} If `rank` is not an integer in `[0, length)`.
|
|
100
|
+
*/
|
|
101
|
+
select(rank) {
|
|
102
|
+
this.selectInto(this.probe_, 0, rank);
|
|
103
|
+
return this.probe_[0];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* {@link select} written to `output[index]`, for the same reason as
|
|
107
|
+
* {@link pushFrom}: no double crosses a call.
|
|
108
|
+
*
|
|
109
|
+
* @throws {RangeError} If `index` is not an integer in `[0, output.length)`
|
|
110
|
+
* or `rank` is out of range; `output` is left unchanged.
|
|
111
|
+
*/
|
|
112
|
+
selectInto(output, index, rank) {
|
|
113
|
+
assertIndex_(output, index);
|
|
114
|
+
if (!Number.isInteger(rank) || rank < 0 || rank >= this.count_) {
|
|
115
|
+
throw new RangeError(`rank must be an integer in [0, ${this.count_}), got ${rank}`);
|
|
116
|
+
}
|
|
117
|
+
output[index] = this.sorted_[rank];
|
|
118
|
+
}
|
|
119
|
+
/** Forgets every value. */
|
|
120
|
+
reset() {
|
|
121
|
+
this.count_ = 0;
|
|
122
|
+
this.oldest_ = 0;
|
|
123
|
+
}
|
|
124
|
+
/** First index in the sorted prefix whose value is not below `probe_[0]`. */
|
|
125
|
+
lowerBound_(count) {
|
|
126
|
+
const sorted = this.sorted_;
|
|
127
|
+
const value = this.probe_[0];
|
|
128
|
+
let low = 0;
|
|
129
|
+
let high = count;
|
|
130
|
+
while (low < high) {
|
|
131
|
+
const middle = (low + high) >> 1;
|
|
132
|
+
if (sorted[middle] < value) {
|
|
133
|
+
low = middle + 1;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
high = middle;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return low;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function assertIndex_(array, index) {
|
|
143
|
+
if (!Number.isInteger(index) || index < 0 || index >= array.length) {
|
|
144
|
+
throw new RangeError(`index must be an integer in [0, ${array.length}), got ${index}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=sliding-median.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sliding-median.js","sourceRoot":"","sources":["../src/sliding-median.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IAChB,YAAY,CAAS;IAEb,QAAQ,CAAe;IACvB,OAAO,CAAe;IACtB,MAAM,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,GAAG,CAAC,CAAC;IACX,OAAO,GAAG,CAAC,CAAC;IAEpB,wEAAwE;IACxE,YAAY,YAAoB;QAC/B,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;YACzD,M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AAS,YAAY,CAAC,KAAmB,EAAE,KAAa;IACvD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACpE,MAAM,IAAI,UAAU,CACnB,mCAAmC,KAAK,CAAC,MAAM,UAAU,KAAK,EAAE,CAChE,CAAC;IACH,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/math-stats",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Descriptive statistics, probability distributions and statistical inference over samples of number.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"distribution",
|
|
@@ -44,14 +44,14 @@
|
|
|
44
44
|
"prepack": "yarn build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ac-kit/algo": "^0.
|
|
48
|
-
"@ac-kit/core": "^0.
|
|
49
|
-
"@ac-kit/math-analysis": "^0.1.
|
|
50
|
-
"@ac-kit/math-scalar": "^0.2.
|
|
47
|
+
"@ac-kit/algo": "^0.4.0",
|
|
48
|
+
"@ac-kit/core": "^0.10.0",
|
|
49
|
+
"@ac-kit/math-analysis": "^0.1.9",
|
|
50
|
+
"@ac-kit/math-scalar": "^0.2.2",
|
|
51
51
|
"@types/web": "^0.0.367"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@ac-kit/test-util": "0.
|
|
54
|
+
"@ac-kit/test-util": "0.3.0",
|
|
55
55
|
"@ac-kit/tsconfig": "0.1.0",
|
|
56
56
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
57
57
|
"@ac-kit/vitest-config": "0.1.1",
|