reconstruct

This commit is contained in:
RaymondHung-datacom 2025-09-25 16:28:20 +09:00
parent 20002030ad
commit ca8bded949
17 changed files with 1268 additions and 1110 deletions

View file

@ -0,0 +1,30 @@
import * as math from 'mathjs';
import * as _ from 'lodash';
export class RollingWindow {
private windows: number[][];
constructor(windows: number[][]) {
this.windows = windows;
}
mean(): number[] {
return this.windows.map(window => Number(math.mean(window)));
}
sum(): number[] {
return this.windows.map(window => _.sum(window));
}
min(): number[] {
return this.windows.map(window => Math.min(...window));
}
max(): number[] {
return this.windows.map(window => Math.max(...window));
}
toArray(): number[][] {
return this.windows;
}
}