/** * Utility to efficiently compute the rolling average and variance over a sliding window of samples * * Taken from https://github.com/BabylonJS/Babylon.js/blob/0f31c20/src/Misc/performanceMonitor.ts#L125 */ export declare class RollingAverage { /** * Current average */ average: number; /** * Current variance */ variance: number; protected _samples: Array; protected _sampleCount: number; protected _pos: number; /** sum of squares of differences from the (current) mean */ protected _m2: number; /** * constructor * @param length The number of samples required to saturate the sliding window */ constructor(length: number); /** * Adds a sample to the sample set * @param v The sample value */ add(v: number): void; /** * Returns previously added values or null if outside of history or outside the sliding window domain * @param i Index in history. For example, pass 0 for the most recent value and 1 for the value before that * @return Value previously recorded with add() or null if outside of range */ history(i: number): number; /** * Returns the number of samples in the RollingAverage. */ sampleCount(): number; /** * Returns true if enough samples have been taken to completely fill the sliding window * @return true if sample-set saturated */ isSaturated(): boolean; /** * Resets the rolling average (equivalent to 0 samples taken so far) */ reset(): void; /** * Wraps a value around the sample range boundaries * @param i Position in sample range, for example if the sample length is 5, and i is -3, then 2 will be returned. * @return Wrapped position in sample range */ protected _wrapPosition(i: number): number; } //# sourceMappingURL=rollingAverage.d.ts.map