UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

275 lines (274 loc) 9.76 kB
import { ComplexType } from './Complex'; import { type ElementType, MultiArray } from './MultiArray'; import { type NodeReturnList } from './AST'; declare abstract class CoreFunctions { /** * * @param name * @param M */ static readonly throwErrorIfCellArray: (name: string, M: MultiArray | ComplexType) => void; /** * Return true if M is an empty matrix * @param X * @returns */ static readonly isempty: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a scalar. * @param X * @returns */ static readonly isscalar: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a 2-D array. * @param X * @returns */ static readonly ismatrix: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a vector. * @param X * @returns */ static readonly isvector: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a cell array object. * @param M * @returns */ static readonly iscell: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a row vector. * @param X * @returns */ static readonly isrow: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a column vector. * @param X * @returns */ static readonly iscolumn: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return true if X is a column vector. * @param X * @returns */ static readonly isstruct: (X?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return the number of dimensions of M. * @param M * @returns */ static readonly ndims: (M?: ElementType, ...rest: unknown[]) => ComplexType; /** * eturn the number of rows of M. * @param M * @returns */ static readonly rows: (M?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return the number of columns of M. * @param M * @returns */ static readonly columns: (M?: ElementType, ...rest: unknown[]) => ComplexType; /** * Return the length of the object M. The length is the number of elements * along the largest dimension. * @param M * @returns */ static readonly Length: (M?: ElementType, ...rest: unknown[]) => ComplexType; /** * * @param M * @param IDX * @returns */ static readonly numel: (M: ElementType, ...IDX: ElementType[]) => ComplexType; /** * Convert linear indices to subscripts. * @param DIMS * @param IND * @returns */ static readonly ind2sub: (DIMS?: ElementType, IND?: ElementType) => NodeReturnList; /** * Convert subscripts to linear indices. * @param DIMS * @param S * @returns */ static readonly sub2ind: (DIMS: ElementType, ...S: ElementType[]) => ElementType; /** * Returns array dimensions. * @param M MultiArray * @param DIM Dimensions * @returns Dimensions of `M` parameter. */ static readonly size: (M?: ElementType, ...DIM: ElementType[]) => ElementType; /** * Return the result of the colon expression. * @param args * @returns */ static readonly colon: (...args: ElementType[]) => ElementType; /** * Return a row vector with linearly spaced elements. * @param args * @returns */ static readonly linspace: (...args: ElementType[]) => ElementType; /** * Return a row vector with elements logarithmically spaced. * @param args * @returns */ static readonly logspace: (...args: ElementType[]) => ElementType; /** * Generate 2-D and 3-D grids. * @param args * @returns */ static readonly meshgrid: (...args: ElementType[]) => NodeReturnList; /** * Given n vectors X1, ..., Xn, returns n arrays of n dimensions. * @returns */ static readonly ndgrid: (...args: ElementType[]) => NodeReturnList; /** * Repeat N-D array. * @param A * @param dim * @returns */ static readonly repmat: (A: ElementType, ...dim: ElementType[]) => ElementType; /** * Return a matrix with the specified dimensions whose elements are taken from the matrix M. * @param M * @param dimension * @returns */ static readonly reshape: (M: ElementType, ...dimension: ElementType[]) => ElementType; /** * Remove singleton dimensions. * @param args * @returns */ static readonly squeeze: (...args: ElementType[]) => ElementType; /** * Create MultiArray with all elements equals `fill` parameter. * @param fill Value to fill MultiArray. * @param dimension Dimensions of created MultiArray. * @returns MultiArray filled with `fill` parameter. */ private static readonly newFilled; /** * Create MultiArray with all elements filled with `fillFunction` result. * The parameter passed to `fillFunction` is a linear index of element. * @param fillFunction Function to be called and the result fills element of MultiArray created. * @param dimension Dimensions of created MultiArray. * @returns MultiArray filled with `fillFunction` results for each element. */ private static readonly newFilledEach; /** * Create array of all zeros. * @param dimension * @returns */ static readonly zeros: (...dimension: ElementType[]) => ElementType; /** * Create array of all ones. * @param dimension * @returns */ static readonly ones: (...dimension: ElementType[]) => ElementType; /** * Uniformly distributed pseudorandom numbers distributed on the * interval (0, 1). * @param dimension * @returns */ static readonly rand: (...dimension: ElementType[]) => ElementType; /** * Uniformly distributed pseudorandom integers. * @param imax * @param args * @returns */ static readonly randi: (range: ElementType, ...dimension: ElementType[]) => ElementType; /** * Return the concatenation of N-D array objects, ARRAY1, ARRAY2, ..., * ARRAYN along dimension `DIM`. * @param DIM Dimension of concatenation. * @param ARRAY Arrays to concatenate. * @returns Concatenated arrays along dimension `DIM`. */ static readonly cat: (DIM: ElementType, ...ARRAY: ElementType[]) => MultiArray; /** * Concatenate arrays horizontally. * @param ARRAY Arrays to concatenate horizontally. * @returns Concatenated arrays horizontally. */ static readonly horzcat: (...ARRAY: ElementType[]) => MultiArray; /** * Concatenate arrays vertically. * @param ARRAY Arrays to concatenate vertically. * @returns Concatenated arrays vertically. */ static readonly vertcat: (...ARRAY: ElementType[]) => MultiArray; static readonly all: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly any: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly sum: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly prod: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly sumsq: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly cumsum: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly cumprod: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly min: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly max: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly cummin: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); static readonly cummax: ((M: ElementType, DIM?: ElementType) => ElementType) | ((...args: ElementType[]) => MultiArray | NodeReturnList | undefined); /** * * @param M * @param DIM * @returns */ static readonly mean: (M: ElementType, DIM?: ElementType) => ElementType; /** * Variance compatible with Octave var(A [, FLAG [, DIM]]) * @param M * @param FLAG * @param DIM * @returns */ static readonly variance: (M: ElementType, FLAG?: ElementType, DIM?: ElementType) => ElementType; /** * * @param M * @param FLAG * @param DIM * @returns */ static readonly std: (M: ElementType, FLAG?: ElementType, DIM?: ElementType) => ElementType; /** * * @param args * @returns */ static readonly struct: (...args: ElementType[]) => ElementType; static readonly norm: (...args: ElementType[]) => ElementType; /** * User functions. */ static functions: { [F in keyof typeof CoreFunctions | string]: Function; }; } export { CoreFunctions }; declare const _default: { CoreFunctions: typeof CoreFunctions; }; export default _default;