import type { DenseMatrixData, DataType, MatrixValue, IndexInterface, ImmutableDenseMatrixJSON, ImmutableDenseMatrixConstructorData } from './types.js'; export type { ImmutableDenseMatrixJSON }; /** * Interface for Index objects (local copy to avoid circular deps) */ interface Index extends IndexInterface { isIndex: true; } /** * Interface for DenseMatrix (local copy to avoid circular deps) */ interface _DenseMatrix { type: string; isDenseMatrix: boolean; _data: DenseMatrixData; _size: number[]; _datatype?: DataType; storage(): string; datatype(): DataType; size(): number[]; clone(): _DenseMatrix; toArray(): DenseMatrixData; valueOf(): DenseMatrixData; subset(index: Index, replacement?: DenseMatrixData | _DenseMatrix | MatrixValue, defaultValue?: MatrixValue): _DenseMatrix | MatrixValue; forEach(callback: (value: MatrixValue, index?: number[], matrix?: _DenseMatrix) => void): void; } /** * Comparison function type. * INTENTIONAL ANY: typed-function resolves actual types at runtime. */ type CompareFunction = (a: MatrixValue, b: MatrixValue) => boolean; /** * Dependencies for ImmutableDenseMatrix factory */ interface ImmutableDenseMatrixDependencies { smaller: CompareFunction; DenseMatrix: new (data?: DenseMatrixData | ImmutableDenseMatrixConstructorData, datatype?: DataType) => _DenseMatrix; } export declare const createImmutableDenseMatrixClass: import("../../utils/factory.js").FactoryFunction void): void; }; /** * Generate a matrix from a JSON object * @param {Object} json An object structured like * `{"mathjs": "ImmutableDenseMatrix", data: [], size: []}`, * where mathjs is optional * @returns {ImmutableDenseMatrix} */ fromJSON(json: ImmutableDenseMatrixJSON): { /** * Type identifier */ readonly type: string; /** * ImmutableDenseMatrix type flag */ readonly isImmutableDenseMatrix: boolean; /** * Internal matrix data storage */ _data: DenseMatrixData; /** * Size of the matrix */ _size: number[]; /** * Data type of matrix elements */ _datatype?: DataType; /** * Cached minimum value * @template T - The element type (inferred from matrix data) */ _min: MatrixValue | null; /** * Cached maximum value * @template T - The element type (inferred from matrix data) */ _max: MatrixValue | null; /** * Get a subset of the matrix, or replace a subset of the matrix. * * Usage: * const subset = matrix.subset(index) // retrieve subset * const value = matrix.subset(index, replacement) // replace subset * * @param {Index} index * @param {Array | ImmutableDenseMatrix | MatrixValue} [replacement] * @param {MatrixValue} [defaultValue=0] Default value, filled in on new entries when * the matrix is resized. If not provided, * new matrix elements will be filled with zeros. */ subset(index: Index, _replacement?: DenseMatrixData | /*elided*/ any | MatrixValue, _defaultValue?: MatrixValue): /*elided*/ any | MatrixValue; /** * Disallows replacing an element in favor of immutability. * @param {Number[]} _index Zero-based index (not used) * @param {MatrixValue} _value The new value (not used) * @param {MatrixValue} [_defaultValue] Default value for new entries (not used) * @throws {Error} Operation not allowed */ set(_index: number[], _value: MatrixValue, _defaultValue?: MatrixValue): /*elided*/ any; /** * Disallows resizing in favor of immutability. * * @param {Number[]} _size The new size (not used) * @param {MatrixValue} [_defaultValue=0] Default value for new entries (not used) * @param {boolean} [_copy] Return a resized copy (not used) * * @throws {Error} Operation not allowed */ resize(_size: number[], _defaultValue?: MatrixValue, _copy?: boolean): /*elided*/ any; /** * Disallows reshaping in favor of immutability. * * @throws {Error} Operation not allowed */ reshape(_size: number[], _copy?: boolean): /*elided*/ any; /** * Create a clone of the matrix * @return {ImmutableDenseMatrix} clone */ clone(): /*elided*/ any; /** * Get a JSON representation of the matrix. * * Note: min and max are intentionally excluded from the JSON output * because they are computed lazily and caching them in JSON serialization * would not be useful (they would need to be recomputed on deserialization * anyway if the matrix data changed). * * @returns {ImmutableDenseMatrixJSON} */ toJSON(): ImmutableDenseMatrixJSON; /** * Disallows swapping rows in favor of immutability. * * @param {Number} _i Matrix row index 1 (not used) * @param {Number} _j Matrix row index 2 (not used) * * @throws {Error} Operation not allowed */ swapRows(_i: number, _j: number): /*elided*/ any; /** * Calculate the minimum value in the set * @return {MatrixValue | undefined} min */ min(): MatrixValue | undefined; /** * Calculate the maximum value in the set * @return {MatrixValue | undefined} max */ max(): MatrixValue | undefined; isDenseMatrix: boolean; storage(): string; datatype(): DataType; size(): number[]; toArray(): DenseMatrixData; valueOf(): DenseMatrixData; forEach(callback: (value: MatrixValue, index?: number[], matrix?: _DenseMatrix) => void): void; }; }>; //# sourceMappingURL=ImmutableDenseMatrix.d.ts.map