numpy-ts 0.8.0 → 0.9.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.
@@ -120,6 +120,66 @@ export declare class NDArray {
120
120
  * @returns New array with powered values
121
121
  */
122
122
  power(exponent: NDArray | number): NDArray;
123
+ /**
124
+ * Natural exponential (e^x) of each element
125
+ * Promotes integer types to float64
126
+ * @returns New array with exp values
127
+ */
128
+ exp(): NDArray;
129
+ /**
130
+ * Base-2 exponential (2^x) of each element
131
+ * Promotes integer types to float64
132
+ * @returns New array with exp2 values
133
+ */
134
+ exp2(): NDArray;
135
+ /**
136
+ * Exponential minus one (e^x - 1) of each element
137
+ * More accurate than exp(x) - 1 for small x
138
+ * Promotes integer types to float64
139
+ * @returns New array with expm1 values
140
+ */
141
+ expm1(): NDArray;
142
+ /**
143
+ * Natural logarithm (ln) of each element
144
+ * Promotes integer types to float64
145
+ * @returns New array with log values
146
+ */
147
+ log(): NDArray;
148
+ /**
149
+ * Base-2 logarithm of each element
150
+ * Promotes integer types to float64
151
+ * @returns New array with log2 values
152
+ */
153
+ log2(): NDArray;
154
+ /**
155
+ * Base-10 logarithm of each element
156
+ * Promotes integer types to float64
157
+ * @returns New array with log10 values
158
+ */
159
+ log10(): NDArray;
160
+ /**
161
+ * Natural logarithm of (1 + x) of each element
162
+ * More accurate than log(1 + x) for small x
163
+ * Promotes integer types to float64
164
+ * @returns New array with log1p values
165
+ */
166
+ log1p(): NDArray;
167
+ /**
168
+ * Logarithm of the sum of exponentials: log(exp(x1) + exp(x2))
169
+ * More numerically stable than computing the expression directly
170
+ * Promotes integer types to float64
171
+ * @param x2 - Second operand (array or scalar)
172
+ * @returns New array with logaddexp values
173
+ */
174
+ logaddexp(x2: NDArray | number): NDArray;
175
+ /**
176
+ * Logarithm base 2 of the sum of exponentials: log2(2^x1 + 2^x2)
177
+ * More numerically stable than computing the expression directly
178
+ * Promotes integer types to float64
179
+ * @param x2 - Second operand (array or scalar)
180
+ * @returns New array with logaddexp2 values
181
+ */
182
+ logaddexp2(x2: NDArray | number): NDArray;
123
183
  /**
124
184
  * Absolute value of each element
125
185
  * @returns New array with absolute values
@@ -135,6 +195,43 @@ export declare class NDArray {
135
195
  * @returns New array with signs
136
196
  */
137
197
  sign(): NDArray;
198
+ /**
199
+ * Round an array to the given number of decimals
200
+ * @param decimals - Number of decimal places to round to (default: 0)
201
+ * @returns New array with rounded values
202
+ */
203
+ around(decimals?: number): NDArray;
204
+ /**
205
+ * Round an array to the given number of decimals (alias for around)
206
+ * @param decimals - Number of decimal places to round to (default: 0)
207
+ * @returns New array with rounded values
208
+ */
209
+ round(decimals?: number): NDArray;
210
+ /**
211
+ * Return the ceiling of the input, element-wise
212
+ * @returns New array with ceiling values
213
+ */
214
+ ceil(): NDArray;
215
+ /**
216
+ * Round to nearest integer towards zero
217
+ * @returns New array with values truncated towards zero
218
+ */
219
+ fix(): NDArray;
220
+ /**
221
+ * Return the floor of the input, element-wise
222
+ * @returns New array with floor values
223
+ */
224
+ floor(): NDArray;
225
+ /**
226
+ * Round elements to the nearest integer
227
+ * @returns New array with rounded integer values
228
+ */
229
+ rint(): NDArray;
230
+ /**
231
+ * Return the truncated value of the input, element-wise
232
+ * @returns New array with truncated values
233
+ */
234
+ trunc(): NDArray;
138
235
  /**
139
236
  * Sine of each element (in radians)
140
237
  * Promotes integer types to float64
@@ -572,6 +669,13 @@ export declare class NDArray {
572
669
  * @returns Indices where values should be inserted
573
670
  */
574
671
  searchsorted(v: NDArray, side?: 'left' | 'right'): NDArray;
672
+ /**
673
+ * Calculate the n-th discrete difference along the given axis
674
+ * @param n - Number of times values are differenced (default: 1)
675
+ * @param axis - Axis along which to compute difference (default: -1)
676
+ * @returns Array of differences
677
+ */
678
+ diff(n?: number, axis?: number): NDArray;
575
679
  /**
576
680
  * Reshape array to a new shape
577
681
  * Returns a new array with the specified shape
@@ -1027,6 +1131,66 @@ export declare function sqrt(x: NDArray): NDArray;
1027
1131
  * @returns Array of x raised to exponent
1028
1132
  */
1029
1133
  export declare function power(x: NDArray, exponent: NDArray | number): NDArray;
1134
+ /**
1135
+ * Element-wise natural exponential (e^x)
1136
+ * @param x - Input array
1137
+ * @returns Array of e^x values
1138
+ */
1139
+ export declare function exp(x: NDArray): NDArray;
1140
+ /**
1141
+ * Element-wise base-2 exponential (2^x)
1142
+ * @param x - Input array
1143
+ * @returns Array of 2^x values
1144
+ */
1145
+ export declare function exp2(x: NDArray): NDArray;
1146
+ /**
1147
+ * Element-wise exponential minus one (e^x - 1)
1148
+ * More accurate than exp(x) - 1 for small x
1149
+ * @param x - Input array
1150
+ * @returns Array of expm1 values
1151
+ */
1152
+ export declare function expm1(x: NDArray): NDArray;
1153
+ /**
1154
+ * Element-wise natural logarithm (ln)
1155
+ * @param x - Input array
1156
+ * @returns Array of log values
1157
+ */
1158
+ export declare function log(x: NDArray): NDArray;
1159
+ /**
1160
+ * Element-wise base-2 logarithm
1161
+ * @param x - Input array
1162
+ * @returns Array of log2 values
1163
+ */
1164
+ export declare function log2(x: NDArray): NDArray;
1165
+ /**
1166
+ * Element-wise base-10 logarithm
1167
+ * @param x - Input array
1168
+ * @returns Array of log10 values
1169
+ */
1170
+ export declare function log10(x: NDArray): NDArray;
1171
+ /**
1172
+ * Element-wise natural logarithm of (1 + x)
1173
+ * More accurate than log(1 + x) for small x
1174
+ * @param x - Input array
1175
+ * @returns Array of log1p values
1176
+ */
1177
+ export declare function log1p(x: NDArray): NDArray;
1178
+ /**
1179
+ * Logarithm of the sum of exponentials: log(exp(x1) + exp(x2))
1180
+ * More numerically stable than computing the expression directly
1181
+ * @param x1 - First input array
1182
+ * @param x2 - Second input array or scalar
1183
+ * @returns Array of logaddexp values
1184
+ */
1185
+ export declare function logaddexp(x1: NDArray, x2: NDArray | number): NDArray;
1186
+ /**
1187
+ * Logarithm base 2 of the sum of exponentials: log2(2^x1 + 2^x2)
1188
+ * More numerically stable than computing the expression directly
1189
+ * @param x1 - First input array
1190
+ * @param x2 - Second input array or scalar
1191
+ * @returns Array of logaddexp2 values
1192
+ */
1193
+ export declare function logaddexp2(x1: NDArray, x2: NDArray | number): NDArray;
1030
1194
  /**
1031
1195
  * Element-wise absolute value
1032
1196
  * @param x - Input array
@@ -1904,6 +2068,108 @@ export declare function unpackbits(a: NDArray, axis?: number, count?: number, bi
1904
2068
  * einsum('ii->', a)
1905
2069
  */
1906
2070
  export declare function einsum(subscripts: string, ...operands: NDArray[]): NDArray | number | bigint;
2071
+ /**
2072
+ * numpy.linalg module - Linear algebra functions
2073
+ */
2074
+ export declare const linalg: {
2075
+ /**
2076
+ * Cross product of two vectors.
2077
+ */
2078
+ cross: (a: NDArray, b: NDArray, axisa?: number, axisb?: number, axisc?: number, axis?: number) => NDArray | number;
2079
+ /**
2080
+ * Compute the norm of a vector or matrix.
2081
+ */
2082
+ norm: (x: NDArray, ord?: number | "fro" | "nuc" | null, axis?: number | [number, number] | null, keepdims?: boolean) => NDArray | number;
2083
+ /**
2084
+ * Compute the vector norm.
2085
+ */
2086
+ vector_norm: (x: NDArray, ord?: number, axis?: number | null, keepdims?: boolean) => NDArray | number;
2087
+ /**
2088
+ * Compute the matrix norm.
2089
+ */
2090
+ matrix_norm: (x: NDArray, ord?: number | "fro" | "nuc", keepdims?: boolean) => NDArray | number;
2091
+ /**
2092
+ * QR decomposition.
2093
+ */
2094
+ qr: (a: NDArray, mode?: "reduced" | "complete" | "r" | "raw") => {
2095
+ q: NDArray;
2096
+ r: NDArray;
2097
+ } | NDArray | {
2098
+ h: NDArray;
2099
+ tau: NDArray;
2100
+ };
2101
+ /**
2102
+ * Cholesky decomposition.
2103
+ */
2104
+ cholesky: (a: NDArray, upper?: boolean) => NDArray;
2105
+ /**
2106
+ * Singular Value Decomposition.
2107
+ */
2108
+ svd: (a: NDArray, full_matrices?: boolean, compute_uv?: boolean) => {
2109
+ u: NDArray;
2110
+ s: NDArray;
2111
+ vt: NDArray;
2112
+ } | NDArray;
2113
+ /**
2114
+ * Compute the determinant of a matrix.
2115
+ */
2116
+ det: (a: NDArray) => number;
2117
+ /**
2118
+ * Compute the matrix inverse.
2119
+ */
2120
+ inv: (a: NDArray) => NDArray;
2121
+ /**
2122
+ * Solve a linear system.
2123
+ */
2124
+ solve: (a: NDArray, b: NDArray) => NDArray;
2125
+ /**
2126
+ * Least-squares solution to a linear matrix equation.
2127
+ */
2128
+ lstsq: (a: NDArray, b: NDArray, rcond?: number | null) => {
2129
+ x: NDArray;
2130
+ residuals: NDArray;
2131
+ rank: number;
2132
+ s: NDArray;
2133
+ };
2134
+ /**
2135
+ * Compute the condition number.
2136
+ */
2137
+ cond: (a: NDArray, p?: number | "fro" | "nuc") => number;
2138
+ /**
2139
+ * Compute the matrix rank.
2140
+ */
2141
+ matrix_rank: (a: NDArray, tol?: number) => number;
2142
+ /**
2143
+ * Raise a square matrix to an integer power.
2144
+ */
2145
+ matrix_power: (a: NDArray, n: number) => NDArray;
2146
+ /**
2147
+ * Compute the Moore-Penrose pseudo-inverse.
2148
+ */
2149
+ pinv: (a: NDArray, rcond?: number) => NDArray;
2150
+ /**
2151
+ * Compute eigenvalues and eigenvectors.
2152
+ */
2153
+ eig: (a: NDArray) => {
2154
+ w: NDArray;
2155
+ v: NDArray;
2156
+ };
2157
+ /**
2158
+ * Compute eigenvalues and eigenvectors of a Hermitian matrix.
2159
+ */
2160
+ eigh: (a: NDArray, UPLO?: "L" | "U") => {
2161
+ w: NDArray;
2162
+ v: NDArray;
2163
+ };
2164
+ /**
2165
+ * Compute eigenvalues of a matrix.
2166
+ */
2167
+ eigvals: (a: NDArray) => NDArray;
2168
+ /**
2169
+ * Compute eigenvalues of a Hermitian matrix.
2170
+ */
2171
+ eigvalsh: (a: NDArray, UPLO?: "L" | "U") => NDArray;
2172
+ };
1907
2173
  /**
1908
2174
  * Take values from the input array by matching 1d index and data slices along axis.
1909
2175
  *
@@ -2135,4 +2401,140 @@ export declare function extract(condition: NDArray, a: NDArray): NDArray;
2135
2401
  * @returns Count of non-zero values
2136
2402
  */
2137
2403
  export declare function count_nonzero(a: NDArray, axis?: number): NDArray | number;
2404
+ /**
2405
+ * Round an array to the given number of decimals
2406
+ * @param a - Input array
2407
+ * @param decimals - Number of decimal places to round to (default: 0)
2408
+ * @returns Rounded array
2409
+ */
2410
+ export declare function around(a: NDArray, decimals?: number): NDArray;
2411
+ /**
2412
+ * Return the ceiling of the input, element-wise
2413
+ * @param x - Input array
2414
+ * @returns Element-wise ceiling
2415
+ */
2416
+ export declare function ceil(x: NDArray): NDArray;
2417
+ /**
2418
+ * Round to nearest integer towards zero
2419
+ * @param x - Input array
2420
+ * @returns Array with values truncated towards zero
2421
+ */
2422
+ export declare function fix(x: NDArray): NDArray;
2423
+ /**
2424
+ * Return the floor of the input, element-wise
2425
+ * @param x - Input array
2426
+ * @returns Element-wise floor
2427
+ */
2428
+ export declare function floor(x: NDArray): NDArray;
2429
+ /**
2430
+ * Round elements of the array to the nearest integer
2431
+ * @param x - Input array
2432
+ * @returns Array with rounded integer values
2433
+ */
2434
+ export declare function rint(x: NDArray): NDArray;
2435
+ /**
2436
+ * Evenly round to the given number of decimals (alias for around)
2437
+ * @param a - Input array
2438
+ * @param decimals - Number of decimal places to round to (default: 0)
2439
+ * @returns Rounded array
2440
+ */
2441
+ export { around as round };
2442
+ /**
2443
+ * Return the truncated value of the input, element-wise
2444
+ * @param x - Input array
2445
+ * @returns Element-wise truncated values
2446
+ */
2447
+ export declare function trunc(x: NDArray): NDArray;
2448
+ /**
2449
+ * Find the unique elements of an array
2450
+ * @param ar - Input array
2451
+ * @param returnIndex - If True, also return the indices of the first occurrences
2452
+ * @param returnInverse - If True, also return the indices to reconstruct the original array
2453
+ * @param returnCounts - If True, also return the number of times each unique value appears
2454
+ * @returns Unique sorted values, and optionally indices/inverse/counts
2455
+ */
2456
+ export declare function unique(ar: NDArray, returnIndex?: boolean, returnInverse?: boolean, returnCounts?: boolean): NDArray | {
2457
+ values: NDArray;
2458
+ indices?: NDArray;
2459
+ inverse?: NDArray;
2460
+ counts?: NDArray;
2461
+ };
2462
+ /**
2463
+ * Test whether each element of a 1-D array is also present in a second array
2464
+ * @param ar1 - Input array
2465
+ * @param ar2 - Test values
2466
+ * @returns Boolean array indicating membership
2467
+ */
2468
+ export declare function in1d(ar1: NDArray, ar2: NDArray): NDArray;
2469
+ /**
2470
+ * Find the intersection of two arrays
2471
+ * @param ar1 - First input array
2472
+ * @param ar2 - Second input array
2473
+ * @returns Sorted 1D array of common and unique elements
2474
+ */
2475
+ export declare function intersect1d(ar1: NDArray, ar2: NDArray): NDArray;
2476
+ /**
2477
+ * Test whether each element of an ND array is also present in a second array
2478
+ * @param element - Input array
2479
+ * @param testElements - Test values
2480
+ * @returns Boolean array indicating membership (same shape as element)
2481
+ */
2482
+ export declare function isin(element: NDArray, testElements: NDArray): NDArray;
2483
+ /**
2484
+ * Find the set difference of two arrays
2485
+ * @param ar1 - First input array
2486
+ * @param ar2 - Second input array
2487
+ * @returns Sorted 1D array of values in ar1 that are not in ar2
2488
+ */
2489
+ export declare function setdiff1d(ar1: NDArray, ar2: NDArray): NDArray;
2490
+ /**
2491
+ * Find the set exclusive-or of two arrays
2492
+ * @param ar1 - First input array
2493
+ * @param ar2 - Second input array
2494
+ * @returns Sorted 1D array of values that are in only one array
2495
+ */
2496
+ export declare function setxor1d(ar1: NDArray, ar2: NDArray): NDArray;
2497
+ /**
2498
+ * Find the union of two arrays
2499
+ * @param ar1 - First input array
2500
+ * @param ar2 - Second input array
2501
+ * @returns Sorted 1D array of unique values from both arrays
2502
+ */
2503
+ export declare function union1d(ar1: NDArray, ar2: NDArray): NDArray;
2504
+ /**
2505
+ * Calculate the n-th discrete difference along the given axis
2506
+ * @param a - Input array
2507
+ * @param n - Number of times values are differenced (default: 1)
2508
+ * @param axis - Axis along which to compute difference (default: -1)
2509
+ * @returns Array of differences
2510
+ */
2511
+ export declare function diff(a: NDArray, n?: number, axis?: number): NDArray;
2512
+ /**
2513
+ * The differences between consecutive elements of a flattened array
2514
+ * @param ary - Input array
2515
+ * @param to_end - Number(s) to append at the end
2516
+ * @param to_begin - Number(s) to prepend at the beginning
2517
+ * @returns Array of differences
2518
+ */
2519
+ export declare function ediff1d(ary: NDArray, to_end?: number[] | null, to_begin?: number[] | null): NDArray;
2520
+ /**
2521
+ * Return the gradient of an N-dimensional array
2522
+ * The gradient is computed using second order accurate central differences
2523
+ * in the interior and first order accurate one-sided differences at the boundaries.
2524
+ * @param f - Input array
2525
+ * @param varargs - Spacing between values (scalar or array per dimension)
2526
+ * @param axis - Axis or axes along which to compute gradient
2527
+ * @returns Array of gradients (one per axis) or single gradient
2528
+ */
2529
+ export declare function gradient(f: NDArray, varargs?: number | number[], axis?: number | number[] | null): NDArray | NDArray[];
2530
+ /**
2531
+ * Return the cross product of two (arrays of) vectors
2532
+ * @param a - First input array
2533
+ * @param b - Second input array
2534
+ * @param axisa - Axis of a that defines the vector(s) (default: -1)
2535
+ * @param axisb - Axis of b that defines the vector(s) (default: -1)
2536
+ * @param axisc - Axis of c containing the cross product (default: -1)
2537
+ * @returns Cross product array
2538
+ */
2539
+ export declare function cross(a: NDArray, b: NDArray, axisa?: number, axisb?: number, axisc?: number): NDArray;
2138
2540
  //# sourceMappingURL=ndarray.d.ts.map
@@ -3,7 +3,7 @@
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, exp, exp2, expm1, log, log2, log10, log1p, logaddexp, logaddexp2, absolute, negative, sign, mod, floor_divide, positive, reciprocal, cbrt, fabs, divmod, square, remainder, heaviside, dot, trace, diagonal, kron, transpose, inner, outer, tensordot, einsum, linalg, 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, around, ceil, fix, floor, rint, round, trunc, unique, in1d, intersect1d, isin, setdiff1d, setxor1d, union1d, diff, ediff1d, gradient, cross, } from './core/ndarray';
7
7
  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';
8
8
  export declare const __version__: string;
9
9
  //# sourceMappingURL=index.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