/** * N-D arrays without dependencies: NDArray (a typed array and a shape, row-major, optionally * complex) and SparseArray (coordinates and values); conversions from and to numjs, scijs * ndarray, nested arrays and JData N-D objects. * * Copyright (c) 2019-2026 Qianqian Fang . BSD 3-clause license. */ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; /** The canonical JData type name (_ArrayType_) of an alias, or null. */ export declare function canonicalType(t: any): string | null; export declare const ELEM_BYTES: { [t: string]: number; }; /** The typed-array constructor holding a JData type (half: Float32Array). */ export declare function typedArrayFor(t: string): any; /** The JData type of a typed array (by name, so that other realms count), or null. */ export declare function typeOfTypedArray(a: any): string | null; export declare function isTypedArray(a: any): boolean; export declare function product(shape: ArrayLike): number; /** Nested arrays of shape from row-major flat data. */ export declare function nest(data: ArrayLike, shape: number[]): any; /** Row-major data of column-major data of a shape (or the reverse, with reverse = true). */ export declare function reorder(data: any, shape: number[], reverse?: boolean): any; /** * An N-D array: row-major `data` (a typed array) of `shape` and JData type `dtype`; `imag` holds * the imaginary parts of a complex array; `attrs` the _ArrayLabel_, _ArrayCoords_, _ArrayUnits_ * annotations it was stored with. */ export declare class NDArray { data: any; shape: number[]; dtype: string; imag?: any; attrs?: { [name: string]: any; }; constructor(data: any, shape?: number[], dtype?: string, imag?: any); get size(): number; get ndim(): number; get iscomplex(): boolean; /** The flat (row-major) position of an index. */ offset(...idx: number[]): number; get(...idx: number[]): any; set(...args: any[]): void; /** The same data in another shape. */ reshape(...shape: any[]): NDArray; /** A copy with the dimensions reversed (the transpose of a matrix). */ transpose(): NDArray; /** Nested arrays ({re, im} elements when complex; numbers for 64-bit integers when exact). */ tolist(): any; toJSON(): any; /** An NDArray of nested arrays of numbers. */ static from(nested: any, dtype?: string): NDArray; } /** A sparse N-D array: 0-based coordinates (one Int32Array per dimension) and values. */ export declare class SparseArray { shape: number[]; indices: Int32Array[]; values: any; imag?: any; dtype: string; constructor(shape: number[], indices: Int32Array[], values: any, dtype: string, imag?: any); get nnz(): number; toDense(): NDArray; toJSON(): any; } /** A typed array of JData type t holding values (numbers, BigInts, NaN strings ...). */ export declare function toTyped(values: ArrayLike, t: string): any; /** The number of a JData special-constant string ("_NaN_", "_Inf_", "-_Inf_"), or of null: NaN. */ export declare function specialNumber(x: any): number; /** Shape and row-major flat values of a numjs NdArray, scijs ndarray, NDArray, JData N-D object, * typed array or (nested) array; null for anything else. */ export declare function arrayOf(x: any): { data: any; shape: number[]; dtype: string | null; } | null;