import type { MatrixLike, Tuple } from "../types"; export type MatrixOperand = Matrix | MatrixLike | number[][]; export type SubmatrixOptions = { removeRows: number[]; removeCols: number[]; xywh?: never; } | { xywh: [number, number] | [number, number, number, number]; removeRows?: never; removeCols?: never; }; type MatrixResult | number> = I extends number ? Matrix : I extends MatrixOperand ? N extends O ? Matrix : never : never; export type MTXOptions = { format?: "coordinate" | "array"; field?: "real" | "complex" | "integer" | "pattern"; symmetry?: "general" | "symmetric" | "skew-symmetric" | "hermitian"; }; /** * A concrete Matrix class for simple linear algebra, currently only supporting * simple numbers, but with plans to add support for complex numbers. * * Implements {@link Iterable} over {@link Tuple} */ export declare class Matrix implements Iterable> { #private; constructor(data: MatrixLike); get rows(): M; get cols(): N; get size(): number; get data(): MatrixLike; static zero(n: N): Matrix; static identity(n: N): Matrix; static withSize(rows: M, cols: N, fillValue?: number): Matrix; static fromDiagonal(diagonal: Tuple | number[]): Matrix; static fromMTX(data: string, options?: MTXOptions): Matrix; static isMatrixLike(arg: unknown, ...dimensions: [m: M, n: N] | []): arg is MatrixLike; isSquare(): boolean; isOrthogonal(): boolean; at(i: number, j: number): number | undefined; row(i: number): Tuple | undefined; col(j: number): Tuple | undefined; clone(): Matrix; submatrix({ removeRows, removeCols, xywh, }: SubmatrixOptions): Matrix; trace(): number; determinant(): number | undefined; augment(other: MatrixOperand): Matrix; inverse(tolerance?: number): Matrix | undefined; transpose(): Matrix; vectorize(): number[]; add(other: MatrixOperand): Matrix; sub(other: MatrixOperand): Matrix; mul | number>(other: I): MatrixResult; pow(k: number): Matrix; eq(other: MatrixOperand, tolerance?: number): boolean; dot(other: MatrixOperand): number; [Symbol.iterator](): IterableIterator>; } export {};