UNPKG

ts-scikit

Version:

A scientific toolkit written in Typescript

119 lines (118 loc) 4.1 kB
export declare class Sampling { private static readonly DEFAULT_TOLERANCE; private readonly _n; private readonly _d; private readonly _f; private readonly _t; private readonly _td; constructor(n: number, d?: number, f?: number, t?: number); /** * This sampling's count. */ get count(): number; /** * This sampling's delta. */ get delta(): number; /** * The first value of this sampling. */ get first(): number; /** * The last value of this sampling. */ get last(): number; /** * Gets the value v[i] of this sampling at a given index. * @param i the index. * @returns the value at index i. */ valueAt(i: number): number; /** * Gets this sampling represented as an array of values. * @returns this sampling as an array. */ values(): number[]; /** * Returns the index of the sample with the specified value. * If this sampling has a sample value that equals (to within the sampling * tolerance) the specified value, then this method returns the * index of that sample. Otherwise, this method returns -1. * @param x the value. * @returns the index of the matching sample; -1, if none. */ indexOf(x: number): number; /** * Returns the index of the sample nearest to the specified value. * @param x the value. * @returns the index of the nearest sample. */ indexOfNearest(x: number): number; /** * Returns the value of the sample nearest to the specified value. * @param x the value. * @returns the value of the nearest sample. */ valueOfNearest(x: number): number; /** * Determines whether the specified index is in the bounds of this sampling. * An index is in bounds if in the range [0, count - 1] of the first and last * sample indices. * @param i the index. * @returns true, if in bounds; false, otherwise. */ isInBounds(i: number): boolean; /** * Determines whether the specified value is in the bounds of this samplineg. * A value is in bounds if in the range [first, last] defined by the first and * last sample values. * @param x the value. * @returns true, if in bounds; false, otherwise. */ valueIsInBounds(x: number): boolean; /** * Shifts this sampling. * This method returns a new sampling; it does not modify this sampling. * @param s the value (shift) to add to this sampling's values. * @returns the new sampling. */ shift(s: number): Sampling; /** * Prepends samples to this sampling. * <p> * This method returns a new sampling; it does not modify this sampling. * @param m the number of new samples * @returns the new sampling. */ prepend(m: number): Sampling; /** * Appends samples to this sampling. * <p> * This method returns a new sampling; it does not modify this sampling. * @param m the number of new samples * @returns the new sampling. */ append(m: number): Sampling; /** * Decimates this sampling. * Beginning with the first sample, keeps only every m'th sample, while * discarding the others in this sampling. If this sampling has n-values, * the new sampling with have 1 + (n - 1) / m values. * <p> * This method returns a new sampling; it does not modify this sampling. * @param m the factor by which to decimate; must be a positive integer. * @returns the new sampling. */ decimate(m: number): Sampling; /** * Interpolates this sampling. * Inserts m - 1 evenly-spaced samples between each of the samples in this * sampling. If this sampling has n-values, the new sampling will have * 1 + (n - 1) * m values. * <p> * This method returns a new sampling; it does not modify this sampling. * @param m the factory by which to interpolate, must be a positive integer. * @returns the new sampling. */ interpolate(m: number): Sampling; }