numpy-ts 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,46 @@
3
3
  *
4
4
  * @module numpy-ts
5
5
  */
6
- export { NDArray, zeros, ones, array, arange, linspace, logspace, geomspace, eye, empty, full, identity, asarray, copy, zeros_like, ones_like, empty_like, full_like, asanyarray, ascontiguousarray, asfortranarray, diag, diagflat, frombuffer, fromfile, fromfunction, fromiter, fromstring, meshgrid, tri, tril, triu, vander, sqrt, power, absolute, negative, sign, mod, floor_divide, positive, reciprocal, cbrt, fabs, divmod, square, remainder, heaviside, dot, trace, diagonal, kron, transpose, inner, outer, tensordot, einsum, sin, cos, tan, arcsin, arccos, arctan, arctan2, hypot, degrees, radians, deg2rad, rad2deg, sinh, cosh, tanh, arcsinh, arccosh, arctanh, swapaxes, moveaxis, concatenate, stack, vstack, hstack, dstack, split, array_split, vsplit, hsplit, tile, repeat, ravel, reshape, squeeze, expand_dims, flip, fliplr, flipud, rot90, roll, rollaxis, atleast_1d, atleast_2d, atleast_3d, dsplit, column_stack, row_stack, resize, append, delete_ as delete, insert, pad, broadcast_to, broadcast_arrays, broadcast_shapes, take, put, choose, array_equal, array_equiv, take_along_axis, put_along_axis, putmask, compress, select, place, diag_indices, diag_indices_from, tril_indices, tril_indices_from, triu_indices, triu_indices_from, mask_indices, indices, ix_, ravel_multi_index, unravel_index, cumsum, cumprod, ptp, median, percentile, quantile, average, nansum, nanprod, nanmean, nanvar, nanstd, nanmin, nanmax, nanargmin, nanargmax, nancumsum, nancumprod, nanmedian, bitwise_and, bitwise_or, bitwise_xor, bitwise_not, invert, left_shift, right_shift, packbits, unpackbits, sort, argsort, lexsort, partition, argpartition, sort_complex, nonzero, flatnonzero, where, searchsorted, extract, count_nonzero, } from './core/ndarray';
6
+ export { NDArray, zeros, ones, array, arange, linspace, logspace, geomspace, eye, empty, full, identity, asarray, copy, zeros_like, ones_like, empty_like, full_like, asanyarray, ascontiguousarray, asfortranarray, diag, diagflat, frombuffer, fromfile, fromfunction, fromiter, fromstring, meshgrid, tri, tril, triu, vander, sqrt, power, pow, // alias for power
7
+ exp, exp2, expm1, log, log2, log10, log1p, logaddexp, logaddexp2, absolute, abs, // alias for absolute
8
+ negative, sign, mod, divide, true_divide, // alias for divide
9
+ floor_divide, positive, reciprocal, cbrt, fabs, divmod, square, remainder, heaviside, float_power, fmod, frexp, gcd, lcm, ldexp, modf, dot, trace, diagonal, kron, transpose, inner, outer, tensordot, einsum, linalg, sin, cos, tan, arcsin, asin, // alias for arcsin
10
+ arccos, acos, // alias for arccos
11
+ arctan, atan, // alias for arctan
12
+ arctan2, atan2, // alias for arctan2
13
+ hypot, degrees, radians, deg2rad, rad2deg, sinh, cosh, tanh, arcsinh, asinh, // alias for arcsinh
14
+ arccosh, acosh, // alias for arccosh
15
+ arctanh, atanh, // alias for arctanh
16
+ swapaxes, moveaxis, concatenate, stack, vstack, hstack, dstack, split, array_split, vsplit, hsplit, tile, repeat, ravel, reshape, squeeze, expand_dims, flip, fliplr, flipud, rot90, roll, rollaxis, atleast_1d, atleast_2d, atleast_3d, dsplit, column_stack, row_stack, resize, append, delete_ as delete, insert, pad, broadcast_to, broadcast_arrays, broadcast_shapes, take, put, copyto, choose, array_equal, array_equiv, take_along_axis, put_along_axis, putmask, compress, select, place, fill_diagonal, diag_indices, diag_indices_from, tril_indices, tril_indices_from, triu_indices, triu_indices_from, mask_indices, indices, ix_, ravel_multi_index, unravel_index, cumsum, cumulative_sum, // alias for cumsum
17
+ cumprod, cumulative_prod, // alias for cumprod
18
+ max, amax, // alias for max
19
+ min, amin, // alias for min
20
+ ptp, median, percentile, quantile, average, nansum, nanprod, nanmean, nanvar, nanstd, nanmin, nanmax, nanargmin, nanargmax, nancumsum, nancumprod, nanmedian, bitwise_and, bitwise_or, bitwise_xor, bitwise_not, invert, left_shift, right_shift, packbits, unpackbits, logical_and, logical_or, logical_not, logical_xor, isfinite, isinf, isnan, isnat, iscomplex, iscomplexobj, isreal, isrealobj, isneginf, isposinf, isfortran, real_if_close, isscalar, iterable, isdtype, promote_types, copysign, signbit, nextafter, spacing, sort, argsort, lexsort, partition, argpartition, sort_complex, nonzero, argwhere, flatnonzero, where, searchsorted, extract, count_nonzero, around, round_, // alias for around
21
+ ceil, fix, floor, rint, round, trunc, unique, in1d, intersect1d, isin, setdiff1d, setxor1d, union1d, diff, ediff1d, gradient, cross, bincount, digitize, histogram, histogram2d, histogramdd, correlate, convolve, cov, corrcoef, } from './core/ndarray';
7
22
  export { parseNpy, serializeNpy, parseNpyHeader, parseNpyData, UnsupportedDTypeError, InvalidNpyError, SUPPORTED_DTYPES, DTYPE_TO_DESCR, type NpyHeader, type NpyMetadata, type NpyVersion, parseNpz, parseNpzSync, loadNpz, loadNpzSync, serializeNpz, serializeNpzSync, type NpzParseOptions, type NpzParseResult, type NpzSerializeOptions, } from './io';
23
+ import * as randomOps from './ops/random';
24
+ import { ArrayStorage } from './core/storage';
25
+ import { NDArray as NDArrayClass } from './core/ndarray';
26
+ import { DType } from './core/dtype';
27
+ export declare const random: {
28
+ seed: typeof randomOps.seed;
29
+ random: (size?: number | number[]) => number | ArrayStorage | NDArrayClass;
30
+ rand: (...shape: number[]) => number | ArrayStorage | NDArrayClass;
31
+ randn: (...shape: number[]) => number | ArrayStorage | NDArrayClass;
32
+ randint: (low: number, high?: number | null, size?: number | number[], dtype?: DType) => number | ArrayStorage | NDArrayClass;
33
+ uniform: (low?: number, high?: number, size?: number | number[]) => number | ArrayStorage | NDArrayClass;
34
+ normal: (loc?: number, scale?: number, size?: number | number[]) => number | ArrayStorage | NDArrayClass;
35
+ standard_normal: (size?: number | number[]) => number | ArrayStorage | NDArrayClass;
36
+ exponential: (scale?: number, size?: number | number[]) => number | ArrayStorage | NDArrayClass;
37
+ poisson: (lam?: number, size?: number | number[]) => number | ArrayStorage | NDArrayClass;
38
+ binomial: (n: number, p: number, size?: number | number[]) => number | ArrayStorage | NDArrayClass;
39
+ choice: (a: number | ArrayStorage, size?: number | number[], replace?: boolean, p?: ArrayStorage | number[]) => number | ArrayStorage | NDArrayClass;
40
+ permutation: (x: number | ArrayStorage) => ArrayStorage | NDArrayClass;
41
+ shuffle: typeof randomOps.shuffle;
42
+ get_state: typeof randomOps.get_state;
43
+ set_state: typeof randomOps.set_state;
44
+ default_rng: typeof randomOps.default_rng;
45
+ Generator: typeof randomOps.Generator;
46
+ };
8
47
  export declare const __version__: string;
9
48
  //# sourceMappingURL=index.d.ts.map
@@ -105,4 +105,11 @@ export declare function ravel_multi_index(multi_index: ArrayStorage[], dims: num
105
105
  * Convert flat index array to tuple of coordinate arrays
106
106
  */
107
107
  export declare function unravel_index(indices: ArrayStorage | number, shape: number[], order?: 'C' | 'F'): ArrayStorage[];
108
+ /**
109
+ * Fill the main diagonal of a given array (modifies in-place)
110
+ * @param a - Array storage (at least 2D)
111
+ * @param val - Value or array of values to fill diagonal with
112
+ * @param wrap - Whether to wrap for tall matrices
113
+ */
114
+ export declare function fill_diagonal(a: ArrayStorage, val: ArrayStorage | number, wrap?: boolean): void;
108
115
  //# sourceMappingURL=advanced.d.ts.map
@@ -159,4 +159,53 @@ export declare function remainder(a: ArrayStorage, b: ArrayStorage | number): Ar
159
159
  * @returns Result storage with heaviside values
160
160
  */
161
161
  export declare function heaviside(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
162
+ /**
163
+ * First array raised to power of second, always promoting to float
164
+ * @param x1 - Base values
165
+ * @param x2 - Exponent values
166
+ * @returns Result in float64
167
+ */
168
+ export declare function float_power(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
169
+ /**
170
+ * Element-wise remainder of division (fmod)
171
+ * Unlike mod/remainder, fmod matches C fmod behavior
172
+ * @param x1 - Dividend
173
+ * @param x2 - Divisor
174
+ * @returns Remainder
175
+ */
176
+ export declare function fmod(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
177
+ /**
178
+ * Decompose floating point numbers into mantissa and exponent
179
+ * Returns [mantissa, exponent] where x = mantissa * 2^exponent
180
+ * @param x - Input array
181
+ * @returns Tuple of [mantissa, exponent] arrays
182
+ */
183
+ export declare function frexp(x: ArrayStorage): [ArrayStorage, ArrayStorage];
184
+ /**
185
+ * Greatest common divisor
186
+ * @param x1 - First array
187
+ * @param x2 - Second array or scalar
188
+ * @returns GCD
189
+ */
190
+ export declare function gcd(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
191
+ /**
192
+ * Least common multiple
193
+ * @param x1 - First array
194
+ * @param x2 - Second array or scalar
195
+ * @returns LCM
196
+ */
197
+ export declare function lcm(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
198
+ /**
199
+ * Returns x1 * 2^x2, element-wise
200
+ * @param x1 - Mantissa
201
+ * @param x2 - Exponent
202
+ * @returns Result
203
+ */
204
+ export declare function ldexp(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
205
+ /**
206
+ * Return fractional and integral parts of array
207
+ * @param x - Input array
208
+ * @returns Tuple of [fractional, integral] arrays
209
+ */
210
+ export declare function modf(x: ArrayStorage): [ArrayStorage, ArrayStorage];
162
211
  //# sourceMappingURL=arithmetic.d.ts.map
@@ -2,7 +2,7 @@
2
2
  * Exponential, logarithmic, and power operations
3
3
  *
4
4
  * Pure functions for element-wise exponential operations:
5
- * exp, log, sqrt, power, etc.
5
+ * exp, exp2, expm1, log, log2, log10, log1p, logaddexp, logaddexp2, sqrt, power
6
6
  *
7
7
  * These functions are used by NDArray methods but are separated
8
8
  * to keep the codebase modular and testable.
@@ -25,4 +25,82 @@ export declare function sqrt(a: ArrayStorage): ArrayStorage;
25
25
  * @returns Result storage with power applied
26
26
  */
27
27
  export declare function power(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
28
+ /**
29
+ * Natural exponential function (e^x) for each element
30
+ * NumPy behavior: Always promotes to float64 for integer types
31
+ *
32
+ * @param a - Input array storage
33
+ * @returns Result storage with exp applied
34
+ */
35
+ export declare function exp(a: ArrayStorage): ArrayStorage;
36
+ /**
37
+ * Base-2 exponential function (2^x) for each element
38
+ * NumPy behavior: Always promotes to float64 for integer types
39
+ *
40
+ * @param a - Input array storage
41
+ * @returns Result storage with 2^x applied
42
+ */
43
+ export declare function exp2(a: ArrayStorage): ArrayStorage;
44
+ /**
45
+ * Exponential minus one (e^x - 1) for each element
46
+ * More accurate than exp(x) - 1 for small x
47
+ * NumPy behavior: Always promotes to float64 for integer types
48
+ *
49
+ * @param a - Input array storage
50
+ * @returns Result storage with expm1 applied
51
+ */
52
+ export declare function expm1(a: ArrayStorage): ArrayStorage;
53
+ /**
54
+ * Natural logarithm (ln) for each element
55
+ * NumPy behavior: Always promotes to float64 for integer types
56
+ *
57
+ * @param a - Input array storage
58
+ * @returns Result storage with log applied
59
+ */
60
+ export declare function log(a: ArrayStorage): ArrayStorage;
61
+ /**
62
+ * Base-2 logarithm for each element
63
+ * NumPy behavior: Always promotes to float64 for integer types
64
+ *
65
+ * @param a - Input array storage
66
+ * @returns Result storage with log2 applied
67
+ */
68
+ export declare function log2(a: ArrayStorage): ArrayStorage;
69
+ /**
70
+ * Base-10 logarithm for each element
71
+ * NumPy behavior: Always promotes to float64 for integer types
72
+ *
73
+ * @param a - Input array storage
74
+ * @returns Result storage with log10 applied
75
+ */
76
+ export declare function log10(a: ArrayStorage): ArrayStorage;
77
+ /**
78
+ * Natural logarithm of (1 + x) for each element
79
+ * More accurate than log(1 + x) for small x
80
+ * NumPy behavior: Always promotes to float64 for integer types
81
+ *
82
+ * @param a - Input array storage
83
+ * @returns Result storage with log1p applied
84
+ */
85
+ export declare function log1p(a: ArrayStorage): ArrayStorage;
86
+ /**
87
+ * Logarithm of the sum of exponentials: log(exp(x1) + exp(x2))
88
+ * More numerically stable than computing the expression directly
89
+ * NumPy behavior: Always promotes to float64 for integer types
90
+ *
91
+ * @param x1 - First input array storage
92
+ * @param x2 - Second input array storage (or scalar)
93
+ * @returns Result storage with logaddexp applied
94
+ */
95
+ export declare function logaddexp(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
96
+ /**
97
+ * Logarithm base 2 of the sum of exponentials: log2(2^x1 + 2^x2)
98
+ * More numerically stable than computing the expression directly
99
+ * NumPy behavior: Always promotes to float64 for integer types
100
+ *
101
+ * @param x1 - First input array storage
102
+ * @param x2 - Second input array storage (or scalar)
103
+ * @returns Result storage with logaddexp2 applied
104
+ */
105
+ export declare function logaddexp2(x1: ArrayStorage, x2: ArrayStorage | number): ArrayStorage;
28
106
  //# sourceMappingURL=exponential.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Gradient and difference operations
3
+ *
4
+ * Pure functions for computing gradients and differences:
5
+ * gradient, diff, ediff1d, cross
6
+ *
7
+ * These functions are used by NDArray methods but are separated
8
+ * to keep the codebase modular and testable.
9
+ */
10
+ import { ArrayStorage } from '../core/storage';
11
+ /**
12
+ * Calculate the n-th discrete difference along the given axis.
13
+ *
14
+ * The first difference is given by out[i] = a[i+1] - a[i] along the given axis.
15
+ * Higher differences are calculated by using diff recursively.
16
+ *
17
+ * @param a - Input array storage
18
+ * @param n - Number of times values are differenced (default: 1)
19
+ * @param axis - Axis along which to compute difference (default: -1, last axis)
20
+ * @returns Result storage with differences
21
+ */
22
+ export declare function diff(a: ArrayStorage, n?: number, axis?: number): ArrayStorage;
23
+ /**
24
+ * The differences between consecutive elements of a flattened array.
25
+ *
26
+ * @param ary - Input array storage
27
+ * @param to_end - Number(s) to append at the end of the returned differences
28
+ * @param to_begin - Number(s) to prepend at the beginning of the returned differences
29
+ * @returns Array of differences with optional prepend/append values
30
+ */
31
+ export declare function ediff1d(ary: ArrayStorage, to_end?: number[] | null, to_begin?: number[] | null): ArrayStorage;
32
+ /**
33
+ * Return the gradient of an N-dimensional array.
34
+ *
35
+ * The gradient is computed using second order accurate central differences in the interior
36
+ * and first order accurate one-sided (forward or backwards) differences at the boundaries.
37
+ *
38
+ * @param f - Input array storage
39
+ * @param varargs - Spacing between values (scalar or array per dimension)
40
+ * @param axis - Axis or axes along which to compute gradient (default: all axes)
41
+ * @returns Array of gradients (one per axis) or single gradient if one axis
42
+ */
43
+ export declare function gradient(f: ArrayStorage, varargs?: number | number[], axis?: number | number[] | null): ArrayStorage | ArrayStorage[];
44
+ /**
45
+ * Return the cross product of two (arrays of) vectors.
46
+ *
47
+ * The cross product of a and b in R^3 is a vector perpendicular to both a and b.
48
+ *
49
+ * @param a - First input array (components of first vector(s))
50
+ * @param b - Second input array (components of second vector(s))
51
+ * @param axisa - Axis of a that defines the vector(s) (default: -1)
52
+ * @param axisb - Axis of b that defines the vector(s) (default: -1)
53
+ * @param axisc - Axis of c containing the cross product vector(s) (default: -1)
54
+ * @returns Cross product array
55
+ */
56
+ export declare function cross(a: ArrayStorage, b: ArrayStorage, axisa?: number, axisb?: number, _axisc?: number): ArrayStorage;
57
+ //# sourceMappingURL=gradient.d.ts.map
@@ -143,4 +143,224 @@ export declare function einsum(subscripts: string, ...operands: ArrayStorage[]):
143
143
  * @returns Kronecker product of a and b
144
144
  */
145
145
  export declare function kron(a: ArrayStorage, b: ArrayStorage): ArrayStorage;
146
+ /**
147
+ * Cross product of two vectors.
148
+ *
149
+ * For 3D vectors: returns the cross product vector
150
+ * For 2D vectors: returns the scalar z-component of the cross product
151
+ *
152
+ * @param a - First input array
153
+ * @param b - Second input array
154
+ * @param axisa - Axis of a that defines the vectors (default: -1)
155
+ * @param axisb - Axis of b that defines the vectors (default: -1)
156
+ * @param axisc - Axis of c containing the cross product vectors (default: -1)
157
+ * @param axis - If defined, the axis of a, b and c that defines the vectors
158
+ * @returns Cross product of a and b
159
+ */
160
+ export declare function cross(a: ArrayStorage, b: ArrayStorage, axisa?: number, axisb?: number, axisc?: number, axis?: number): ArrayStorage | number;
161
+ /**
162
+ * Vector norm.
163
+ *
164
+ * @param x - Input vector or array
165
+ * @param ord - Order of the norm (default: 2)
166
+ * - Infinity: max(abs(x))
167
+ * - -Infinity: min(abs(x))
168
+ * - 0: sum(x != 0)
169
+ * - Other: sum(abs(x)^ord)^(1/ord)
170
+ * @param axis - Axis along which to compute (flattened if not specified)
171
+ * @param keepdims - Keep reduced dimensions
172
+ * @returns Vector norm
173
+ */
174
+ export declare function vector_norm(x: ArrayStorage, ord?: number | 'fro' | 'nuc', axis?: number | null, keepdims?: boolean): ArrayStorage | number;
175
+ /**
176
+ * Matrix norm.
177
+ *
178
+ * @param x - Input 2D array
179
+ * @param ord - Order of the norm:
180
+ * - 'fro': Frobenius norm (default)
181
+ * - 'nuc': Nuclear norm (sum of singular values)
182
+ * - 1: Max column sum (max(sum(abs(x), axis=0)))
183
+ * - -1: Min column sum (min(sum(abs(x), axis=0)))
184
+ * - 2: Largest singular value
185
+ * - -2: Smallest singular value
186
+ * - Infinity: Max row sum (max(sum(abs(x), axis=1)))
187
+ * - -Infinity: Min row sum (min(sum(abs(x), axis=1)))
188
+ * @param keepdims - Keep reduced dimensions
189
+ * @returns Matrix norm
190
+ */
191
+ export declare function matrix_norm(x: ArrayStorage, ord?: number | 'fro' | 'nuc', keepdims?: boolean): ArrayStorage | number;
192
+ /**
193
+ * General norm function (for both vectors and matrices).
194
+ *
195
+ * @param x - Input array
196
+ * @param ord - Order of the norm (default: 'fro' for 2D, 2 for 1D)
197
+ * @param axis - Axis or axes along which to compute
198
+ * @param keepdims - Keep reduced dimensions
199
+ * @returns Norm
200
+ */
201
+ export declare function norm(x: ArrayStorage, ord?: number | 'fro' | 'nuc' | null, axis?: number | [number, number] | null, keepdims?: boolean): ArrayStorage | number;
202
+ /**
203
+ * QR decomposition using Householder reflections.
204
+ *
205
+ * @param a - Input matrix (m x n)
206
+ * @param mode - 'reduced' (default), 'complete', 'r', or 'raw'
207
+ * @returns { q, r } where A = Q @ R
208
+ */
209
+ export declare function qr(a: ArrayStorage, mode?: 'reduced' | 'complete' | 'r' | 'raw'): {
210
+ q: ArrayStorage;
211
+ r: ArrayStorage;
212
+ } | ArrayStorage | {
213
+ h: ArrayStorage;
214
+ tau: ArrayStorage;
215
+ };
216
+ /**
217
+ * Cholesky decomposition.
218
+ *
219
+ * Returns the lower triangular matrix L such that A = L @ L^T
220
+ * for a symmetric positive-definite matrix A.
221
+ *
222
+ * @param a - Symmetric positive-definite matrix
223
+ * @param upper - If true, return upper triangular U such that A = U^T @ U
224
+ * @returns Lower (or upper) triangular Cholesky factor
225
+ */
226
+ export declare function cholesky(a: ArrayStorage, upper?: boolean): ArrayStorage;
227
+ /**
228
+ * Singular Value Decomposition.
229
+ *
230
+ * @param a - Input matrix (m x n)
231
+ * @param full_matrices - If true, return full U and V^T, otherwise reduced
232
+ * @param compute_uv - If true, return U, S, V^T; if false, return only S
233
+ * @returns { u, s, vt } or just s depending on compute_uv
234
+ */
235
+ export declare function svd(a: ArrayStorage, full_matrices?: boolean, compute_uv?: boolean): {
236
+ u: ArrayStorage;
237
+ s: ArrayStorage;
238
+ vt: ArrayStorage;
239
+ } | ArrayStorage;
240
+ /**
241
+ * Compute the determinant of a square matrix.
242
+ *
243
+ * Uses LU decomposition for numerical stability.
244
+ *
245
+ * @param a - Square matrix
246
+ * @returns Determinant
247
+ */
248
+ export declare function det(a: ArrayStorage): number;
249
+ /**
250
+ * Compute the matrix inverse - optimized to do LU decomposition once.
251
+ *
252
+ * @param a - Square matrix
253
+ * @returns Inverse matrix
254
+ */
255
+ export declare function inv(a: ArrayStorage): ArrayStorage;
256
+ /**
257
+ * Solve a linear system A @ x = b.
258
+ *
259
+ * @param a - Coefficient matrix (n x n)
260
+ * @param b - Right-hand side (n,) or (n, k)
261
+ * @returns Solution x with same shape as b
262
+ */
263
+ export declare function solve(a: ArrayStorage, b: ArrayStorage): ArrayStorage;
264
+ /**
265
+ * Compute the least-squares solution to a linear matrix equation.
266
+ *
267
+ * @param a - Coefficient matrix (m x n)
268
+ * @param b - Right-hand side (m,) or (m, k)
269
+ * @param rcond - Cutoff for small singular values (default: machine precision * max(m, n))
270
+ * @returns { x, residuals, rank, s } - Solution, residuals, effective rank, singular values
271
+ */
272
+ export declare function lstsq(a: ArrayStorage, b: ArrayStorage, rcond?: number | null): {
273
+ x: ArrayStorage;
274
+ residuals: ArrayStorage;
275
+ rank: number;
276
+ s: ArrayStorage;
277
+ };
278
+ /**
279
+ * Compute the condition number of a matrix.
280
+ *
281
+ * @param a - Input matrix
282
+ * @param p - Order of the norm (default: 2, -2, 'fro', or inf)
283
+ * @returns Condition number
284
+ */
285
+ export declare function cond(a: ArrayStorage, p?: number | 'fro' | 'nuc'): number;
286
+ /**
287
+ * Compute the rank of a matrix using SVD.
288
+ *
289
+ * @param a - Input matrix
290
+ * @param tol - Threshold below which singular values are considered zero
291
+ * @returns Matrix rank
292
+ */
293
+ export declare function matrix_rank(a: ArrayStorage, tol?: number): number;
294
+ /**
295
+ * Raise a square matrix to an integer power.
296
+ *
297
+ * @param a - Input square matrix
298
+ * @param n - Integer power (can be negative)
299
+ * @returns Matrix raised to power n
300
+ */
301
+ export declare function matrix_power(a: ArrayStorage, n: number): ArrayStorage;
302
+ /**
303
+ * Compute the Moore-Penrose pseudo-inverse using SVD.
304
+ *
305
+ * @param a - Input matrix
306
+ * @param rcond - Cutoff for small singular values
307
+ * @returns Pseudo-inverse of a
308
+ */
309
+ export declare function pinv(a: ArrayStorage, rcond?: number): ArrayStorage;
310
+ /**
311
+ * Compute eigenvalues and right eigenvectors of a square matrix.
312
+ *
313
+ * For general matrices, uses iterative methods.
314
+ * For symmetric matrices, use eigh for better performance.
315
+ *
316
+ * **Limitation**: Complex eigenvalues are not supported. For non-symmetric matrices,
317
+ * this function returns only the real parts of eigenvalues. If your matrix has
318
+ * complex eigenvalues (e.g., rotation matrices), results will be incorrect.
319
+ * Use eigh() for symmetric matrices where eigenvalues are guaranteed to be real.
320
+ *
321
+ * @param a - Input square matrix
322
+ * @returns { w, v } - Eigenvalues (real only) and eigenvector matrix
323
+ */
324
+ export declare function eig(a: ArrayStorage): {
325
+ w: ArrayStorage;
326
+ v: ArrayStorage;
327
+ };
328
+ /**
329
+ * Compute eigenvalues and eigenvectors of a real symmetric matrix.
330
+ *
331
+ * Note: Named "Hermitian" for NumPy compatibility, but only real symmetric
332
+ * matrices are supported (complex Hermitian matrices require complex dtype support).
333
+ * Symmetric matrices always have real eigenvalues, so results are exact.
334
+ *
335
+ * @param a - Real symmetric matrix
336
+ * @param UPLO - 'L' or 'U' to use lower or upper triangle (default: 'L')
337
+ * @returns { w, v } - Eigenvalues (sorted ascending) and eigenvector matrix
338
+ */
339
+ export declare function eigh(a: ArrayStorage, UPLO?: 'L' | 'U'): {
340
+ w: ArrayStorage;
341
+ v: ArrayStorage;
342
+ };
343
+ /**
344
+ * Compute eigenvalues of a general square matrix.
345
+ *
346
+ * **Limitation**: Complex eigenvalues are not supported. For non-symmetric matrices,
347
+ * this function returns only real approximations. Use eigvalsh() for symmetric
348
+ * matrices where eigenvalues are guaranteed to be real.
349
+ *
350
+ * @param a - Input square matrix
351
+ * @returns Array of eigenvalues (real only)
352
+ */
353
+ export declare function eigvals(a: ArrayStorage): ArrayStorage;
354
+ /**
355
+ * Compute eigenvalues of a real symmetric matrix.
356
+ *
357
+ * Note: Named "Hermitian" for NumPy compatibility, but only real symmetric
358
+ * matrices are supported (complex Hermitian matrices require complex dtype support).
359
+ * Symmetric matrices always have real eigenvalues, so results are exact.
360
+ *
361
+ * @param a - Real symmetric matrix
362
+ * @param UPLO - 'L' or 'U' to use lower or upper triangle
363
+ * @returns Array of eigenvalues (sorted ascending)
364
+ */
365
+ export declare function eigvalsh(a: ArrayStorage, UPLO?: 'L' | 'U'): ArrayStorage;
146
366
  //# sourceMappingURL=linalg.d.ts.map