numpy-ts 0.5.0 → 0.7.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.
- package/README.md +36 -38
- package/dist/numpy-ts.browser.js +2 -2
- package/dist/numpy-ts.esm.js +2 -2
- package/dist/numpy-ts.node-io.cjs +2 -2
- package/dist/numpy-ts.node-io.cjs.map +4 -4
- package/dist/numpy-ts.node-io.mjs +2 -2
- package/dist/numpy-ts.node-io.mjs.map +4 -4
- package/dist/numpy-ts.node.cjs +2 -2
- package/dist/numpy-ts.node.cjs.map +4 -4
- package/dist/types/core/broadcasting.d.ts +18 -0
- package/dist/types/core/ndarray.d.ts +989 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ops/advanced.d.ts +74 -0
- package/dist/types/ops/arithmetic.d.ts +54 -0
- package/dist/types/ops/bitwise.d.ts +91 -0
- package/dist/types/ops/comparison.d.ts +12 -0
- package/dist/types/ops/linalg.d.ts +51 -0
- package/dist/types/ops/reduction.d.ts +76 -0
- package/dist/types/ops/shape.d.ts +44 -0
- package/dist/types/ops/trig.d.ts +16 -0
- package/package.json +5 -4
|
@@ -284,6 +284,46 @@ export declare class NDArray {
|
|
|
284
284
|
* @returns Boolean array (represented as uint8: 1=true, 0=false)
|
|
285
285
|
*/
|
|
286
286
|
allclose(other: NDArray | number, rtol?: number, atol?: number): boolean;
|
|
287
|
+
/**
|
|
288
|
+
* Bitwise AND element-wise
|
|
289
|
+
* @param other - Array or scalar for AND operation (must be integer type)
|
|
290
|
+
* @returns Result of bitwise AND
|
|
291
|
+
*/
|
|
292
|
+
bitwise_and(other: NDArray | number): NDArray;
|
|
293
|
+
/**
|
|
294
|
+
* Bitwise OR element-wise
|
|
295
|
+
* @param other - Array or scalar for OR operation (must be integer type)
|
|
296
|
+
* @returns Result of bitwise OR
|
|
297
|
+
*/
|
|
298
|
+
bitwise_or(other: NDArray | number): NDArray;
|
|
299
|
+
/**
|
|
300
|
+
* Bitwise XOR element-wise
|
|
301
|
+
* @param other - Array or scalar for XOR operation (must be integer type)
|
|
302
|
+
* @returns Result of bitwise XOR
|
|
303
|
+
*/
|
|
304
|
+
bitwise_xor(other: NDArray | number): NDArray;
|
|
305
|
+
/**
|
|
306
|
+
* Bitwise NOT (inversion) element-wise
|
|
307
|
+
* @returns Result of bitwise NOT
|
|
308
|
+
*/
|
|
309
|
+
bitwise_not(): NDArray;
|
|
310
|
+
/**
|
|
311
|
+
* Invert (bitwise NOT) element-wise - alias for bitwise_not
|
|
312
|
+
* @returns Result of bitwise inversion
|
|
313
|
+
*/
|
|
314
|
+
invert(): NDArray;
|
|
315
|
+
/**
|
|
316
|
+
* Left shift elements by positions
|
|
317
|
+
* @param shift - Shift amount (array or scalar)
|
|
318
|
+
* @returns Result of left shift
|
|
319
|
+
*/
|
|
320
|
+
left_shift(shift: NDArray | number): NDArray;
|
|
321
|
+
/**
|
|
322
|
+
* Right shift elements by positions
|
|
323
|
+
* @param shift - Shift amount (array or scalar)
|
|
324
|
+
* @returns Result of right shift
|
|
325
|
+
*/
|
|
326
|
+
right_shift(shift: NDArray | number): NDArray;
|
|
287
327
|
/**
|
|
288
328
|
* Sum array elements over a given axis
|
|
289
329
|
* @param axis - Axis along which to sum. If undefined, sum all elements
|
|
@@ -363,6 +403,137 @@ export declare class NDArray {
|
|
|
363
403
|
* @returns Boolean or array of booleans
|
|
364
404
|
*/
|
|
365
405
|
any(axis?: number, keepdims?: boolean): NDArray | boolean;
|
|
406
|
+
/**
|
|
407
|
+
* Return the cumulative sum of elements along a given axis
|
|
408
|
+
* @param axis - Axis along which to compute cumsum. If undefined, compute over flattened array.
|
|
409
|
+
* @returns Array with cumulative sums
|
|
410
|
+
*/
|
|
411
|
+
cumsum(axis?: number): NDArray;
|
|
412
|
+
/**
|
|
413
|
+
* Return the cumulative product of elements along a given axis
|
|
414
|
+
* @param axis - Axis along which to compute cumprod. If undefined, compute over flattened array.
|
|
415
|
+
* @returns Array with cumulative products
|
|
416
|
+
*/
|
|
417
|
+
cumprod(axis?: number): NDArray;
|
|
418
|
+
/**
|
|
419
|
+
* Peak to peak (maximum - minimum) value along a given axis
|
|
420
|
+
* @param axis - Axis along which to compute ptp. If undefined, compute over all elements.
|
|
421
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
422
|
+
* @returns Range of values
|
|
423
|
+
*/
|
|
424
|
+
ptp(axis?: number, keepdims?: boolean): NDArray | number;
|
|
425
|
+
/**
|
|
426
|
+
* Compute the median along the specified axis
|
|
427
|
+
* @param axis - Axis along which to compute median. If undefined, compute over all elements.
|
|
428
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
429
|
+
* @returns Median of array elements
|
|
430
|
+
*/
|
|
431
|
+
median(axis?: number, keepdims?: boolean): NDArray | number;
|
|
432
|
+
/**
|
|
433
|
+
* Compute the q-th percentile of the data along the specified axis
|
|
434
|
+
* @param q - Percentile to compute (0-100)
|
|
435
|
+
* @param axis - Axis along which to compute percentile. If undefined, compute over all elements.
|
|
436
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
437
|
+
* @returns Percentile of array elements
|
|
438
|
+
*/
|
|
439
|
+
percentile(q: number, axis?: number, keepdims?: boolean): NDArray | number;
|
|
440
|
+
/**
|
|
441
|
+
* Compute the q-th quantile of the data along the specified axis
|
|
442
|
+
* @param q - Quantile to compute (0-1)
|
|
443
|
+
* @param axis - Axis along which to compute quantile. If undefined, compute over all elements.
|
|
444
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
445
|
+
* @returns Quantile of array elements
|
|
446
|
+
*/
|
|
447
|
+
quantile(q: number, axis?: number, keepdims?: boolean): NDArray | number;
|
|
448
|
+
/**
|
|
449
|
+
* Compute the weighted average along the specified axis
|
|
450
|
+
* @param weights - Array of weights (optional)
|
|
451
|
+
* @param axis - Axis along which to compute average. If undefined, compute over all elements.
|
|
452
|
+
* @returns Weighted average of array elements
|
|
453
|
+
*/
|
|
454
|
+
average(weights?: NDArray, axis?: number): NDArray | number;
|
|
455
|
+
/**
|
|
456
|
+
* Return the sum of array elements, treating NaNs as zero
|
|
457
|
+
* @param axis - Axis along which to compute sum. If undefined, compute over all elements.
|
|
458
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
459
|
+
* @returns Sum of array elements ignoring NaNs
|
|
460
|
+
*/
|
|
461
|
+
nansum(axis?: number, keepdims?: boolean): NDArray | number;
|
|
462
|
+
/**
|
|
463
|
+
* Return the product of array elements, treating NaNs as ones
|
|
464
|
+
* @param axis - Axis along which to compute product. If undefined, compute over all elements.
|
|
465
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
466
|
+
* @returns Product of array elements ignoring NaNs
|
|
467
|
+
*/
|
|
468
|
+
nanprod(axis?: number, keepdims?: boolean): NDArray | number;
|
|
469
|
+
/**
|
|
470
|
+
* Compute the arithmetic mean, ignoring NaNs
|
|
471
|
+
* @param axis - Axis along which to compute mean. If undefined, compute over all elements.
|
|
472
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
473
|
+
* @returns Mean of array elements ignoring NaNs
|
|
474
|
+
*/
|
|
475
|
+
nanmean(axis?: number, keepdims?: boolean): NDArray | number;
|
|
476
|
+
/**
|
|
477
|
+
* Compute the variance, ignoring NaNs
|
|
478
|
+
* @param axis - Axis along which to compute variance. If undefined, compute over all elements.
|
|
479
|
+
* @param ddof - Delta degrees of freedom (default: 0)
|
|
480
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
481
|
+
* @returns Variance of array elements ignoring NaNs
|
|
482
|
+
*/
|
|
483
|
+
nanvar(axis?: number, ddof?: number, keepdims?: boolean): NDArray | number;
|
|
484
|
+
/**
|
|
485
|
+
* Compute the standard deviation, ignoring NaNs
|
|
486
|
+
* @param axis - Axis along which to compute std. If undefined, compute over all elements.
|
|
487
|
+
* @param ddof - Delta degrees of freedom (default: 0)
|
|
488
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
489
|
+
* @returns Standard deviation of array elements ignoring NaNs
|
|
490
|
+
*/
|
|
491
|
+
nanstd(axis?: number, ddof?: number, keepdims?: boolean): NDArray | number;
|
|
492
|
+
/**
|
|
493
|
+
* Return minimum of an array or minimum along an axis, ignoring NaNs
|
|
494
|
+
* @param axis - Axis along which to compute minimum. If undefined, compute over all elements.
|
|
495
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
496
|
+
* @returns Minimum of array elements ignoring NaNs
|
|
497
|
+
*/
|
|
498
|
+
nanmin(axis?: number, keepdims?: boolean): NDArray | number;
|
|
499
|
+
/**
|
|
500
|
+
* Return maximum of an array or maximum along an axis, ignoring NaNs
|
|
501
|
+
* @param axis - Axis along which to compute maximum. If undefined, compute over all elements.
|
|
502
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
503
|
+
* @returns Maximum of array elements ignoring NaNs
|
|
504
|
+
*/
|
|
505
|
+
nanmax(axis?: number, keepdims?: boolean): NDArray | number;
|
|
506
|
+
/**
|
|
507
|
+
* Return the indices of the minimum values, ignoring NaNs
|
|
508
|
+
* @param axis - Axis along which to find minimum indices. If undefined, index of global minimum.
|
|
509
|
+
* @returns Indices of minimum values ignoring NaNs
|
|
510
|
+
*/
|
|
511
|
+
nanargmin(axis?: number): NDArray | number;
|
|
512
|
+
/**
|
|
513
|
+
* Return the indices of the maximum values, ignoring NaNs
|
|
514
|
+
* @param axis - Axis along which to find maximum indices. If undefined, index of global maximum.
|
|
515
|
+
* @returns Indices of maximum values ignoring NaNs
|
|
516
|
+
*/
|
|
517
|
+
nanargmax(axis?: number): NDArray | number;
|
|
518
|
+
/**
|
|
519
|
+
* Return the cumulative sum of elements, treating NaNs as zero
|
|
520
|
+
* @param axis - Axis along which to compute cumsum. If undefined, compute over flattened array.
|
|
521
|
+
* @returns Array with cumulative sums ignoring NaNs
|
|
522
|
+
*/
|
|
523
|
+
nancumsum(axis?: number): NDArray;
|
|
524
|
+
/**
|
|
525
|
+
* Return the cumulative product of elements, treating NaNs as one
|
|
526
|
+
* @param axis - Axis along which to compute cumprod. If undefined, compute over flattened array.
|
|
527
|
+
* @returns Array with cumulative products ignoring NaNs
|
|
528
|
+
*/
|
|
529
|
+
nancumprod(axis?: number): NDArray;
|
|
530
|
+
/**
|
|
531
|
+
* Compute the median, ignoring NaNs
|
|
532
|
+
* @param axis - Axis along which to compute median. If undefined, compute over all elements.
|
|
533
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
534
|
+
* @returns Median of array elements ignoring NaNs
|
|
535
|
+
*/
|
|
536
|
+
nanmedian(axis?: number, keepdims?: boolean): NDArray | number;
|
|
366
537
|
/**
|
|
367
538
|
* Reshape array to a new shape
|
|
368
539
|
* Returns a new array with the specified shape
|
|
@@ -468,6 +639,40 @@ export declare class NDArray {
|
|
|
468
639
|
* @returns Tensor dot product result
|
|
469
640
|
*/
|
|
470
641
|
tensordot(other: NDArray, axes?: number | [number[], number[]]): NDArray | number | bigint;
|
|
642
|
+
/**
|
|
643
|
+
* Element-wise cube root
|
|
644
|
+
* Promotes integer types to float64
|
|
645
|
+
* @returns New array with cube root values
|
|
646
|
+
*/
|
|
647
|
+
cbrt(): NDArray;
|
|
648
|
+
/**
|
|
649
|
+
* Element-wise absolute value (always returns float)
|
|
650
|
+
* @returns New array with absolute values as float
|
|
651
|
+
*/
|
|
652
|
+
fabs(): NDArray;
|
|
653
|
+
/**
|
|
654
|
+
* Returns both quotient and remainder (floor divide and modulo)
|
|
655
|
+
* @param divisor - Array or scalar divisor
|
|
656
|
+
* @returns Tuple of [quotient, remainder] arrays
|
|
657
|
+
*/
|
|
658
|
+
divmod(divisor: NDArray | number): [NDArray, NDArray];
|
|
659
|
+
/**
|
|
660
|
+
* Element-wise square (x**2)
|
|
661
|
+
* @returns New array with squared values
|
|
662
|
+
*/
|
|
663
|
+
square(): NDArray;
|
|
664
|
+
/**
|
|
665
|
+
* Element-wise remainder (same as mod)
|
|
666
|
+
* @param divisor - Array or scalar divisor
|
|
667
|
+
* @returns New array with remainder values
|
|
668
|
+
*/
|
|
669
|
+
remainder(divisor: NDArray | number): NDArray;
|
|
670
|
+
/**
|
|
671
|
+
* Heaviside step function
|
|
672
|
+
* @param x2 - Value to use when this array element is 0
|
|
673
|
+
* @returns New array with heaviside values
|
|
674
|
+
*/
|
|
675
|
+
heaviside(x2: NDArray | number): NDArray;
|
|
471
676
|
/**
|
|
472
677
|
* Slice the array using NumPy-style string syntax
|
|
473
678
|
*
|
|
@@ -647,6 +852,130 @@ export declare function empty_like(a: NDArray, dtype?: DType): NDArray;
|
|
|
647
852
|
* @returns Filled array
|
|
648
853
|
*/
|
|
649
854
|
export declare function full_like(a: NDArray, fill_value: number | bigint | boolean, dtype?: DType): NDArray;
|
|
855
|
+
/**
|
|
856
|
+
* Convert input to an ndarray (alias for asarray for compatibility)
|
|
857
|
+
* In numpy-ts, this behaves the same as asarray since we don't have subclasses
|
|
858
|
+
* @param a - Input data
|
|
859
|
+
* @param dtype - Data type (optional)
|
|
860
|
+
* @returns NDArray
|
|
861
|
+
*/
|
|
862
|
+
export declare function asanyarray(a: NDArray | any, dtype?: DType): NDArray;
|
|
863
|
+
/**
|
|
864
|
+
* Return a contiguous array (ndim >= 1) in memory (C order)
|
|
865
|
+
* Since our arrays are already C-contiguous in memory, this either
|
|
866
|
+
* returns the input unchanged or creates a contiguous copy
|
|
867
|
+
* @param a - Input data
|
|
868
|
+
* @param dtype - Data type (optional)
|
|
869
|
+
* @returns Contiguous array in C order
|
|
870
|
+
*/
|
|
871
|
+
export declare function ascontiguousarray(a: NDArray | any, dtype?: DType): NDArray;
|
|
872
|
+
/**
|
|
873
|
+
* Return an array laid out in Fortran order in memory
|
|
874
|
+
* Note: numpy-ts uses C-order internally, so this creates a copy
|
|
875
|
+
* that is equivalent to the Fortran-ordered layout
|
|
876
|
+
* @param a - Input data
|
|
877
|
+
* @param dtype - Data type (optional)
|
|
878
|
+
* @returns Array (copy in C order, as Fortran order is not supported)
|
|
879
|
+
*/
|
|
880
|
+
export declare function asfortranarray(a: NDArray | any, dtype?: DType): NDArray;
|
|
881
|
+
/**
|
|
882
|
+
* Extract a diagonal or construct a diagonal array
|
|
883
|
+
* @param v - Input array (if 2D, extract diagonal; if 1D, construct diagonal matrix)
|
|
884
|
+
* @param k - Diagonal offset (default 0 is main diagonal, positive above, negative below)
|
|
885
|
+
* @returns Diagonal elements as 1D array, or 2D diagonal matrix
|
|
886
|
+
*/
|
|
887
|
+
export declare function diag(v: NDArray, k?: number): NDArray;
|
|
888
|
+
/**
|
|
889
|
+
* Create a 2-D array with the flattened input as a diagonal
|
|
890
|
+
* @param v - Input array (will be flattened)
|
|
891
|
+
* @param k - Diagonal offset (default 0)
|
|
892
|
+
* @returns 2D diagonal matrix
|
|
893
|
+
*/
|
|
894
|
+
export declare function diagflat(v: NDArray, k?: number): NDArray;
|
|
895
|
+
/**
|
|
896
|
+
* Construct an array by executing a function over each coordinate
|
|
897
|
+
* @param fn - Function that takes coordinate indices and returns value
|
|
898
|
+
* @param shape - Shape of output array
|
|
899
|
+
* @param dtype - Data type (default: float64)
|
|
900
|
+
* @returns Array with values computed from function
|
|
901
|
+
*/
|
|
902
|
+
export declare function fromfunction(fn: (...indices: number[]) => number | bigint | boolean, shape: number[], dtype?: DType): NDArray;
|
|
903
|
+
/**
|
|
904
|
+
* Return coordinate matrices from coordinate vectors
|
|
905
|
+
* @param arrays - 1D coordinate arrays
|
|
906
|
+
* @param indexing - 'xy' (Cartesian, default) or 'ij' (matrix indexing)
|
|
907
|
+
* @returns Array of coordinate grids
|
|
908
|
+
*/
|
|
909
|
+
export declare function meshgrid(...args: (NDArray | {
|
|
910
|
+
indexing?: 'xy' | 'ij';
|
|
911
|
+
})[]): NDArray[];
|
|
912
|
+
/**
|
|
913
|
+
* An array with ones at and below the given diagonal and zeros elsewhere
|
|
914
|
+
* @param N - Number of rows
|
|
915
|
+
* @param M - Number of columns (default: N)
|
|
916
|
+
* @param k - Diagonal offset (default 0)
|
|
917
|
+
* @param dtype - Data type (default: float64)
|
|
918
|
+
* @returns Triangular array
|
|
919
|
+
*/
|
|
920
|
+
export declare function tri(N: number, M?: number, k?: number, dtype?: DType): NDArray;
|
|
921
|
+
/**
|
|
922
|
+
* Lower triangle of an array
|
|
923
|
+
* @param m - Input array
|
|
924
|
+
* @param k - Diagonal above which to zero elements (default 0)
|
|
925
|
+
* @returns Copy with upper triangle zeroed
|
|
926
|
+
*/
|
|
927
|
+
export declare function tril(m: NDArray, k?: number): NDArray;
|
|
928
|
+
/**
|
|
929
|
+
* Upper triangle of an array
|
|
930
|
+
* @param m - Input array
|
|
931
|
+
* @param k - Diagonal below which to zero elements (default 0)
|
|
932
|
+
* @returns Copy with lower triangle zeroed
|
|
933
|
+
*/
|
|
934
|
+
export declare function triu(m: NDArray, k?: number): NDArray;
|
|
935
|
+
/**
|
|
936
|
+
* Generate a Vandermonde matrix
|
|
937
|
+
* @param x - Input 1D array
|
|
938
|
+
* @param N - Number of columns (default: length of x)
|
|
939
|
+
* @param increasing - Order of powers (default: false, highest powers first)
|
|
940
|
+
* @returns Vandermonde matrix
|
|
941
|
+
*/
|
|
942
|
+
export declare function vander(x: NDArray, N?: number, increasing?: boolean): NDArray;
|
|
943
|
+
/**
|
|
944
|
+
* Interpret a buffer as a 1-dimensional array
|
|
945
|
+
* @param buffer - Buffer-like object (ArrayBuffer, TypedArray, or DataView)
|
|
946
|
+
* @param dtype - Data type (default: float64)
|
|
947
|
+
* @param count - Number of items to read (-1 means all)
|
|
948
|
+
* @param offset - Start reading from this byte offset
|
|
949
|
+
* @returns NDArray from buffer data
|
|
950
|
+
*/
|
|
951
|
+
export declare function frombuffer(buffer: ArrayBuffer | ArrayBufferView, dtype?: DType, count?: number, offset?: number): NDArray;
|
|
952
|
+
/**
|
|
953
|
+
* Construct an array by executing a function over each coordinate.
|
|
954
|
+
* Note: This is a JS implementation - fromfile for actual files isn't directly applicable in browser JS.
|
|
955
|
+
* This function creates an array from an iterable or callable.
|
|
956
|
+
* @param file - In JS context, this is an iterable yielding values
|
|
957
|
+
* @param dtype - Data type
|
|
958
|
+
* @param count - Number of items to read (-1 means all)
|
|
959
|
+
* @returns NDArray from the iterable
|
|
960
|
+
*/
|
|
961
|
+
export declare function fromfile(file: Iterable<number | bigint>, dtype?: DType, count?: number): NDArray;
|
|
962
|
+
/**
|
|
963
|
+
* Create a new 1-dimensional array from an iterable object
|
|
964
|
+
* @param iter - Iterable object
|
|
965
|
+
* @param dtype - Data type
|
|
966
|
+
* @param count - Number of items to read (-1 means all)
|
|
967
|
+
* @returns NDArray from the iterable
|
|
968
|
+
*/
|
|
969
|
+
export declare function fromiter(iter: Iterable<number | bigint>, dtype?: DType, count?: number): NDArray;
|
|
970
|
+
/**
|
|
971
|
+
* Create a new 1-dimensional array from text string
|
|
972
|
+
* @param string - Input string containing numbers separated by whitespace or separator
|
|
973
|
+
* @param dtype - Data type (default: float64)
|
|
974
|
+
* @param count - Number of items to read (-1 means all)
|
|
975
|
+
* @param sep - Separator between values (default: any whitespace)
|
|
976
|
+
* @returns NDArray from parsed string
|
|
977
|
+
*/
|
|
978
|
+
export declare function fromstring(string: string, dtype?: DType, count?: number, sep?: string): NDArray;
|
|
650
979
|
/**
|
|
651
980
|
* Element-wise square root
|
|
652
981
|
* @param x - Input array
|
|
@@ -730,6 +1059,24 @@ export declare function dot(a: NDArray, b: NDArray): NDArray | number | bigint;
|
|
|
730
1059
|
* @returns Sum of diagonal elements
|
|
731
1060
|
*/
|
|
732
1061
|
export declare function trace(a: NDArray): number | bigint;
|
|
1062
|
+
/**
|
|
1063
|
+
* Extract a diagonal from a matrix or N-D array
|
|
1064
|
+
*
|
|
1065
|
+
* @param a - Input array (must be at least 2D)
|
|
1066
|
+
* @param offset - Offset of the diagonal from the main diagonal (default: 0)
|
|
1067
|
+
* @param axis1 - First axis (default: 0)
|
|
1068
|
+
* @param axis2 - Second axis (default: 1)
|
|
1069
|
+
* @returns Array containing the diagonal elements
|
|
1070
|
+
*/
|
|
1071
|
+
export declare function diagonal(a: NDArray, offset?: number, axis1?: number, axis2?: number): NDArray;
|
|
1072
|
+
/**
|
|
1073
|
+
* Kronecker product of two arrays
|
|
1074
|
+
*
|
|
1075
|
+
* @param a - First input array
|
|
1076
|
+
* @param b - Second input array
|
|
1077
|
+
* @returns Kronecker product of a and b
|
|
1078
|
+
*/
|
|
1079
|
+
export declare function kron(a: NDArray, b: NDArray): NDArray;
|
|
733
1080
|
/**
|
|
734
1081
|
* Permute array dimensions
|
|
735
1082
|
*
|
|
@@ -831,6 +1178,18 @@ export declare function degrees(x: NDArray): NDArray;
|
|
|
831
1178
|
* @returns Angles in radians
|
|
832
1179
|
*/
|
|
833
1180
|
export declare function radians(x: NDArray): NDArray;
|
|
1181
|
+
/**
|
|
1182
|
+
* Convert angles from degrees to radians (alias for radians)
|
|
1183
|
+
* @param x - Input array (angles in degrees)
|
|
1184
|
+
* @returns Angles in radians
|
|
1185
|
+
*/
|
|
1186
|
+
export declare function deg2rad(x: NDArray): NDArray;
|
|
1187
|
+
/**
|
|
1188
|
+
* Convert angles from radians to degrees (alias for degrees)
|
|
1189
|
+
* @param x - Input array (angles in radians)
|
|
1190
|
+
* @returns Angles in degrees
|
|
1191
|
+
*/
|
|
1192
|
+
export declare function rad2deg(x: NDArray): NDArray;
|
|
834
1193
|
/**
|
|
835
1194
|
* Element-wise hyperbolic sine
|
|
836
1195
|
* @param x - Input array
|
|
@@ -973,6 +1332,175 @@ export declare function tile(a: NDArray, reps: number | number[]): NDArray;
|
|
|
973
1332
|
* @returns Array with repeated elements
|
|
974
1333
|
*/
|
|
975
1334
|
export declare function repeat(a: NDArray, repeats: number | number[], axis?: number): NDArray;
|
|
1335
|
+
/**
|
|
1336
|
+
* Return a contiguous flattened array
|
|
1337
|
+
*
|
|
1338
|
+
* @param a - Input array
|
|
1339
|
+
* @returns Flattened 1-D array (view if possible)
|
|
1340
|
+
*/
|
|
1341
|
+
export declare function ravel(a: NDArray): NDArray;
|
|
1342
|
+
/**
|
|
1343
|
+
* Reshape array to new shape
|
|
1344
|
+
*
|
|
1345
|
+
* @param a - Input array
|
|
1346
|
+
* @param newShape - New shape
|
|
1347
|
+
* @returns Reshaped array (view if possible)
|
|
1348
|
+
*/
|
|
1349
|
+
export declare function reshape(a: NDArray, newShape: number[]): NDArray;
|
|
1350
|
+
/**
|
|
1351
|
+
* Remove axes of length 1
|
|
1352
|
+
*
|
|
1353
|
+
* @param a - Input array
|
|
1354
|
+
* @param axis - Axis to squeeze (optional, squeezes all if not specified)
|
|
1355
|
+
* @returns Squeezed array (view)
|
|
1356
|
+
*/
|
|
1357
|
+
export declare function squeeze(a: NDArray, axis?: number): NDArray;
|
|
1358
|
+
/**
|
|
1359
|
+
* Expand the shape of an array by inserting a new axis
|
|
1360
|
+
*
|
|
1361
|
+
* @param a - Input array
|
|
1362
|
+
* @param axis - Position where new axis should be inserted
|
|
1363
|
+
* @returns Array with expanded shape (view)
|
|
1364
|
+
*/
|
|
1365
|
+
export declare function expand_dims(a: NDArray, axis: number): NDArray;
|
|
1366
|
+
/**
|
|
1367
|
+
* Reverse the order of elements along the given axis
|
|
1368
|
+
*
|
|
1369
|
+
* @param m - Input array
|
|
1370
|
+
* @param axis - Axis or axes to flip (flips all if undefined)
|
|
1371
|
+
* @returns Flipped array
|
|
1372
|
+
*/
|
|
1373
|
+
export declare function flip(m: NDArray, axis?: number | number[]): NDArray;
|
|
1374
|
+
/**
|
|
1375
|
+
* Flip array in the left/right direction (reverse along axis 1)
|
|
1376
|
+
*
|
|
1377
|
+
* @param m - Input array (must be at least 2-D)
|
|
1378
|
+
* @returns Flipped array
|
|
1379
|
+
*/
|
|
1380
|
+
export declare function fliplr(m: NDArray): NDArray;
|
|
1381
|
+
/**
|
|
1382
|
+
* Flip array in the up/down direction (reverse along axis 0)
|
|
1383
|
+
*
|
|
1384
|
+
* @param m - Input array (must be at least 2-D)
|
|
1385
|
+
* @returns Flipped array
|
|
1386
|
+
*/
|
|
1387
|
+
export declare function flipud(m: NDArray): NDArray;
|
|
1388
|
+
/**
|
|
1389
|
+
* Rotate array by 90 degrees
|
|
1390
|
+
*
|
|
1391
|
+
* @param m - Input array
|
|
1392
|
+
* @param k - Number of times to rotate (default 1)
|
|
1393
|
+
* @param axes - The axes to rotate in (default [0, 1])
|
|
1394
|
+
* @returns Rotated array
|
|
1395
|
+
*/
|
|
1396
|
+
export declare function rot90(m: NDArray, k?: number, axes?: [number, number]): NDArray;
|
|
1397
|
+
/**
|
|
1398
|
+
* Roll array elements along a given axis
|
|
1399
|
+
*
|
|
1400
|
+
* @param a - Input array
|
|
1401
|
+
* @param shift - Number of positions to shift
|
|
1402
|
+
* @param axis - Axis along which to roll (rolls flattened array if undefined)
|
|
1403
|
+
* @returns Rolled array
|
|
1404
|
+
*/
|
|
1405
|
+
export declare function roll(a: NDArray, shift: number | number[], axis?: number | number[]): NDArray;
|
|
1406
|
+
/**
|
|
1407
|
+
* Roll the specified axis backwards until it lies in a given position
|
|
1408
|
+
*
|
|
1409
|
+
* @param a - Input array
|
|
1410
|
+
* @param axis - The axis to roll backwards
|
|
1411
|
+
* @param start - Position to roll to (default 0)
|
|
1412
|
+
* @returns Array with rolled axis (view)
|
|
1413
|
+
*/
|
|
1414
|
+
export declare function rollaxis(a: NDArray, axis: number, start?: number): NDArray;
|
|
1415
|
+
/**
|
|
1416
|
+
* Convert inputs to arrays with at least 1 dimension
|
|
1417
|
+
*
|
|
1418
|
+
* @param arrays - Input arrays
|
|
1419
|
+
* @returns Arrays with at least 1 dimension
|
|
1420
|
+
*/
|
|
1421
|
+
export declare function atleast_1d(...arrays: NDArray[]): NDArray | NDArray[];
|
|
1422
|
+
/**
|
|
1423
|
+
* Convert inputs to arrays with at least 2 dimensions
|
|
1424
|
+
*
|
|
1425
|
+
* @param arrays - Input arrays
|
|
1426
|
+
* @returns Arrays with at least 2 dimensions
|
|
1427
|
+
*/
|
|
1428
|
+
export declare function atleast_2d(...arrays: NDArray[]): NDArray | NDArray[];
|
|
1429
|
+
/**
|
|
1430
|
+
* Convert inputs to arrays with at least 3 dimensions
|
|
1431
|
+
*
|
|
1432
|
+
* @param arrays - Input arrays
|
|
1433
|
+
* @returns Arrays with at least 3 dimensions
|
|
1434
|
+
*/
|
|
1435
|
+
export declare function atleast_3d(...arrays: NDArray[]): NDArray | NDArray[];
|
|
1436
|
+
/**
|
|
1437
|
+
* Split array along third axis (depth)
|
|
1438
|
+
*
|
|
1439
|
+
* @param ary - Input array (must be at least 3-D)
|
|
1440
|
+
* @param indices_or_sections - Number of sections or indices where to split
|
|
1441
|
+
* @returns List of sub-arrays
|
|
1442
|
+
*/
|
|
1443
|
+
export declare function dsplit(ary: NDArray, indices_or_sections: number | number[]): NDArray[];
|
|
1444
|
+
/**
|
|
1445
|
+
* Stack 1-D arrays as columns into a 2-D array
|
|
1446
|
+
*
|
|
1447
|
+
* @param arrays - 1-D arrays to stack
|
|
1448
|
+
* @returns 2-D array with inputs as columns
|
|
1449
|
+
*/
|
|
1450
|
+
export declare function column_stack(arrays: NDArray[]): NDArray;
|
|
1451
|
+
/**
|
|
1452
|
+
* Stack arrays in sequence vertically (alias for vstack)
|
|
1453
|
+
*
|
|
1454
|
+
* @param arrays - Arrays to stack
|
|
1455
|
+
* @returns Vertically stacked array
|
|
1456
|
+
*/
|
|
1457
|
+
export declare function row_stack(arrays: NDArray[]): NDArray;
|
|
1458
|
+
/**
|
|
1459
|
+
* Return a new array with the given shape (repeating data if needed)
|
|
1460
|
+
*
|
|
1461
|
+
* @param a - Input array
|
|
1462
|
+
* @param new_shape - New shape
|
|
1463
|
+
* @returns Resized array
|
|
1464
|
+
*/
|
|
1465
|
+
export declare function resize(a: NDArray, new_shape: number[]): NDArray;
|
|
1466
|
+
/**
|
|
1467
|
+
* Append values to the end of an array
|
|
1468
|
+
*
|
|
1469
|
+
* @param arr - Input array
|
|
1470
|
+
* @param values - Values to append
|
|
1471
|
+
* @param axis - Axis along which to append (flattens if undefined)
|
|
1472
|
+
* @returns Array with values appended
|
|
1473
|
+
*/
|
|
1474
|
+
export declare function append(arr: NDArray, values: NDArray | ArrayLike<number | bigint> | number, axis?: number): NDArray;
|
|
1475
|
+
/**
|
|
1476
|
+
* Return a new array with sub-arrays along an axis deleted
|
|
1477
|
+
*
|
|
1478
|
+
* @param arr - Input array
|
|
1479
|
+
* @param obj - Indices to delete
|
|
1480
|
+
* @param axis - Axis along which to delete (flattens if undefined)
|
|
1481
|
+
* @returns Array with elements deleted
|
|
1482
|
+
*/
|
|
1483
|
+
export declare function delete_(arr: NDArray, obj: number | number[], axis?: number): NDArray;
|
|
1484
|
+
/**
|
|
1485
|
+
* Insert values along the given axis before the given indices
|
|
1486
|
+
*
|
|
1487
|
+
* @param arr - Input array
|
|
1488
|
+
* @param obj - Index before which to insert
|
|
1489
|
+
* @param values - Values to insert
|
|
1490
|
+
* @param axis - Axis along which to insert (flattens if undefined)
|
|
1491
|
+
* @returns Array with values inserted
|
|
1492
|
+
*/
|
|
1493
|
+
export declare function insert(arr: NDArray, obj: number, values: NDArray | ArrayLike<number | bigint> | number, axis?: number): NDArray;
|
|
1494
|
+
/**
|
|
1495
|
+
* Pad an array
|
|
1496
|
+
*
|
|
1497
|
+
* @param array - Input array
|
|
1498
|
+
* @param pad_width - Number of values padded to edges of each axis
|
|
1499
|
+
* @param mode - Padding mode ('constant', 'edge', 'reflect', 'symmetric', 'wrap')
|
|
1500
|
+
* @param constant_values - Value for constant padding (default 0)
|
|
1501
|
+
* @returns Padded array
|
|
1502
|
+
*/
|
|
1503
|
+
export declare function pad(arr: NDArray, pad_width: number | [number, number] | Array<[number, number]>, mode?: 'constant' | 'edge' | 'reflect' | 'symmetric' | 'wrap', constant_values?: number): NDArray;
|
|
976
1504
|
/**
|
|
977
1505
|
* Broadcast an array to a given shape
|
|
978
1506
|
*
|
|
@@ -988,6 +1516,17 @@ export declare function broadcast_to(a: NDArray, shape: number[]): NDArray;
|
|
|
988
1516
|
* @returns Arrays broadcast to common shape
|
|
989
1517
|
*/
|
|
990
1518
|
export declare function broadcast_arrays(...arrays: NDArray[]): NDArray[];
|
|
1519
|
+
/**
|
|
1520
|
+
* Compute the broadcast shape for multiple shapes
|
|
1521
|
+
*
|
|
1522
|
+
* Returns the resulting shape if all shapes are broadcast-compatible.
|
|
1523
|
+
* Throws an error if shapes are not broadcast-compatible.
|
|
1524
|
+
*
|
|
1525
|
+
* @param shapes - Variable number of shapes to broadcast
|
|
1526
|
+
* @returns The broadcast output shape
|
|
1527
|
+
* @throws Error if shapes are not broadcast-compatible
|
|
1528
|
+
*/
|
|
1529
|
+
export declare function broadcast_shapes(...shapes: number[][]): number[];
|
|
991
1530
|
/**
|
|
992
1531
|
* Take elements from an array along an axis
|
|
993
1532
|
*
|
|
@@ -1022,4 +1561,454 @@ export declare function choose(a: NDArray, choices: NDArray[]): NDArray;
|
|
|
1022
1561
|
* @returns True if arrays are equal element-wise
|
|
1023
1562
|
*/
|
|
1024
1563
|
export declare function array_equal(a: NDArray, b: NDArray, equal_nan?: boolean): boolean;
|
|
1564
|
+
/**
|
|
1565
|
+
* Returns True if two arrays are element-wise equal within a tolerance.
|
|
1566
|
+
* Unlike array_equal, this function broadcasts the arrays before comparison.
|
|
1567
|
+
*
|
|
1568
|
+
* @param a1 - First input array
|
|
1569
|
+
* @param a2 - Second input array
|
|
1570
|
+
* @returns True if arrays are equivalent (after broadcasting)
|
|
1571
|
+
*/
|
|
1572
|
+
export declare function array_equiv(a1: NDArray, a2: NDArray): boolean;
|
|
1573
|
+
/**
|
|
1574
|
+
* Return the cumulative sum of the elements along a given axis.
|
|
1575
|
+
* @param a - Input array
|
|
1576
|
+
* @param axis - Axis along which to compute. If undefined, flattened array is used.
|
|
1577
|
+
* @returns Array with cumulative sums
|
|
1578
|
+
*/
|
|
1579
|
+
export declare function cumsum(a: NDArray, axis?: number): NDArray;
|
|
1580
|
+
/**
|
|
1581
|
+
* Return the cumulative product of the elements along a given axis.
|
|
1582
|
+
* @param a - Input array
|
|
1583
|
+
* @param axis - Axis along which to compute. If undefined, flattened array is used.
|
|
1584
|
+
* @returns Array with cumulative products
|
|
1585
|
+
*/
|
|
1586
|
+
export declare function cumprod(a: NDArray, axis?: number): NDArray;
|
|
1587
|
+
/**
|
|
1588
|
+
* Peak to peak (maximum - minimum) value along a given axis.
|
|
1589
|
+
* @param a - Input array
|
|
1590
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1591
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1592
|
+
* @returns Peak to peak value(s)
|
|
1593
|
+
*/
|
|
1594
|
+
export declare function ptp(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1595
|
+
/**
|
|
1596
|
+
* Compute the median along the specified axis.
|
|
1597
|
+
* @param a - Input array
|
|
1598
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1599
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1600
|
+
* @returns Median value(s)
|
|
1601
|
+
*/
|
|
1602
|
+
export declare function median(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1603
|
+
/**
|
|
1604
|
+
* Compute the q-th percentile of the data along the specified axis.
|
|
1605
|
+
* @param a - Input array
|
|
1606
|
+
* @param q - Percentile (0-100)
|
|
1607
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1608
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1609
|
+
* @returns Percentile value(s)
|
|
1610
|
+
*/
|
|
1611
|
+
export declare function percentile(a: NDArray, q: number, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1612
|
+
/**
|
|
1613
|
+
* Compute the q-th quantile of the data along the specified axis.
|
|
1614
|
+
* @param a - Input array
|
|
1615
|
+
* @param q - Quantile (0-1)
|
|
1616
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1617
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1618
|
+
* @returns Quantile value(s)
|
|
1619
|
+
*/
|
|
1620
|
+
export declare function quantile(a: NDArray, q: number, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1621
|
+
/**
|
|
1622
|
+
* Compute the weighted average along the specified axis.
|
|
1623
|
+
* @param a - Input array
|
|
1624
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1625
|
+
* @param weights - Array of weights (must be same shape as array along specified axis)
|
|
1626
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1627
|
+
* @returns Weighted average value(s)
|
|
1628
|
+
*/
|
|
1629
|
+
export declare function average(a: NDArray, axis?: number, weights?: NDArray, keepdims?: boolean): NDArray | number;
|
|
1630
|
+
/**
|
|
1631
|
+
* Return the sum of array elements over a given axis, treating NaNs as zero.
|
|
1632
|
+
* @param a - Input array
|
|
1633
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1634
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1635
|
+
* @returns Sum value(s)
|
|
1636
|
+
*/
|
|
1637
|
+
export declare function nansum(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1638
|
+
/**
|
|
1639
|
+
* Return the product of array elements over a given axis, treating NaNs as one.
|
|
1640
|
+
* @param a - Input array
|
|
1641
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1642
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1643
|
+
* @returns Product value(s)
|
|
1644
|
+
*/
|
|
1645
|
+
export declare function nanprod(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1646
|
+
/**
|
|
1647
|
+
* Compute the arithmetic mean along the specified axis, ignoring NaNs.
|
|
1648
|
+
* @param a - Input array
|
|
1649
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1650
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1651
|
+
* @returns Mean value(s)
|
|
1652
|
+
*/
|
|
1653
|
+
export declare function nanmean(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1654
|
+
/**
|
|
1655
|
+
* Compute the variance along the specified axis, ignoring NaNs.
|
|
1656
|
+
* @param a - Input array
|
|
1657
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1658
|
+
* @param ddof - Delta degrees of freedom (default 0)
|
|
1659
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1660
|
+
* @returns Variance value(s)
|
|
1661
|
+
*/
|
|
1662
|
+
export declare function nanvar(a: NDArray, axis?: number, ddof?: number, keepdims?: boolean): NDArray | number;
|
|
1663
|
+
/**
|
|
1664
|
+
* Compute the standard deviation along the specified axis, ignoring NaNs.
|
|
1665
|
+
* @param a - Input array
|
|
1666
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1667
|
+
* @param ddof - Delta degrees of freedom (default 0)
|
|
1668
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1669
|
+
* @returns Standard deviation value(s)
|
|
1670
|
+
*/
|
|
1671
|
+
export declare function nanstd(a: NDArray, axis?: number, ddof?: number, keepdims?: boolean): NDArray | number;
|
|
1672
|
+
/**
|
|
1673
|
+
* Return minimum of an array, ignoring NaNs.
|
|
1674
|
+
* @param a - Input array
|
|
1675
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1676
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1677
|
+
* @returns Minimum value(s)
|
|
1678
|
+
*/
|
|
1679
|
+
export declare function nanmin(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1680
|
+
/**
|
|
1681
|
+
* Return maximum of an array, ignoring NaNs.
|
|
1682
|
+
* @param a - Input array
|
|
1683
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1684
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1685
|
+
* @returns Maximum value(s)
|
|
1686
|
+
*/
|
|
1687
|
+
export declare function nanmax(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1688
|
+
/**
|
|
1689
|
+
* Return indices of the minimum value, ignoring NaNs.
|
|
1690
|
+
* @param a - Input array
|
|
1691
|
+
* @param axis - Axis along which to compute. If undefined, use flattened array.
|
|
1692
|
+
* @returns Index/indices of minimum value(s)
|
|
1693
|
+
*/
|
|
1694
|
+
export declare function nanargmin(a: NDArray, axis?: number): NDArray | number;
|
|
1695
|
+
/**
|
|
1696
|
+
* Return indices of the maximum value, ignoring NaNs.
|
|
1697
|
+
* @param a - Input array
|
|
1698
|
+
* @param axis - Axis along which to compute. If undefined, use flattened array.
|
|
1699
|
+
* @returns Index/indices of maximum value(s)
|
|
1700
|
+
*/
|
|
1701
|
+
export declare function nanargmax(a: NDArray, axis?: number): NDArray | number;
|
|
1702
|
+
/**
|
|
1703
|
+
* Return cumulative sum of elements, treating NaNs as zero.
|
|
1704
|
+
* @param a - Input array
|
|
1705
|
+
* @param axis - Axis along which to compute. If undefined, use flattened array.
|
|
1706
|
+
* @returns Array with cumulative sums
|
|
1707
|
+
*/
|
|
1708
|
+
export declare function nancumsum(a: NDArray, axis?: number): NDArray;
|
|
1709
|
+
/**
|
|
1710
|
+
* Return cumulative product of elements, treating NaNs as one.
|
|
1711
|
+
* @param a - Input array
|
|
1712
|
+
* @param axis - Axis along which to compute. If undefined, use flattened array.
|
|
1713
|
+
* @returns Array with cumulative products
|
|
1714
|
+
*/
|
|
1715
|
+
export declare function nancumprod(a: NDArray, axis?: number): NDArray;
|
|
1716
|
+
/**
|
|
1717
|
+
* Compute the median, ignoring NaNs.
|
|
1718
|
+
* @param a - Input array
|
|
1719
|
+
* @param axis - Axis along which to compute. If undefined, use all elements.
|
|
1720
|
+
* @param keepdims - If true, reduced axes are left as dimensions with size 1
|
|
1721
|
+
* @returns Median value(s)
|
|
1722
|
+
*/
|
|
1723
|
+
export declare function nanmedian(a: NDArray, axis?: number, keepdims?: boolean): NDArray | number;
|
|
1724
|
+
/**
|
|
1725
|
+
* Element-wise cube root
|
|
1726
|
+
*
|
|
1727
|
+
* @param x - Input array
|
|
1728
|
+
* @returns Array with cube root of each element
|
|
1729
|
+
*/
|
|
1730
|
+
export declare function cbrt(x: NDArray): NDArray;
|
|
1731
|
+
/**
|
|
1732
|
+
* Element-wise absolute value (always returns float)
|
|
1733
|
+
*
|
|
1734
|
+
* @param x - Input array
|
|
1735
|
+
* @returns Array with absolute values as float
|
|
1736
|
+
*/
|
|
1737
|
+
export declare function fabs(x: NDArray): NDArray;
|
|
1738
|
+
/**
|
|
1739
|
+
* Returns both quotient and remainder (floor divide and modulo)
|
|
1740
|
+
*
|
|
1741
|
+
* @param x - Dividend array
|
|
1742
|
+
* @param y - Divisor (array or scalar)
|
|
1743
|
+
* @returns Tuple of [quotient, remainder] arrays
|
|
1744
|
+
*/
|
|
1745
|
+
export declare function divmod(x: NDArray, y: NDArray | number): [NDArray, NDArray];
|
|
1746
|
+
/**
|
|
1747
|
+
* Element-wise square (x**2)
|
|
1748
|
+
*
|
|
1749
|
+
* @param x - Input array
|
|
1750
|
+
* @returns Array with squared values
|
|
1751
|
+
*/
|
|
1752
|
+
export declare function square(x: NDArray): NDArray;
|
|
1753
|
+
/**
|
|
1754
|
+
* Element-wise remainder (same as mod)
|
|
1755
|
+
*
|
|
1756
|
+
* @param x - Dividend array
|
|
1757
|
+
* @param y - Divisor (array or scalar)
|
|
1758
|
+
* @returns Array with remainder values
|
|
1759
|
+
*/
|
|
1760
|
+
export declare function remainder(x: NDArray, y: NDArray | number): NDArray;
|
|
1761
|
+
/**
|
|
1762
|
+
* Heaviside step function
|
|
1763
|
+
*
|
|
1764
|
+
* @param x1 - Input array
|
|
1765
|
+
* @param x2 - Value to use when x1 is 0
|
|
1766
|
+
* @returns Array with heaviside values (0 if x1 < 0, x2 if x1 == 0, 1 if x1 > 0)
|
|
1767
|
+
*/
|
|
1768
|
+
export declare function heaviside(x1: NDArray, x2: NDArray | number): NDArray;
|
|
1769
|
+
/**
|
|
1770
|
+
* Bitwise AND element-wise
|
|
1771
|
+
*
|
|
1772
|
+
* @param x1 - First input array (must be integer type)
|
|
1773
|
+
* @param x2 - Second input array or scalar (must be integer type)
|
|
1774
|
+
* @returns Result of bitwise AND
|
|
1775
|
+
*/
|
|
1776
|
+
export declare function bitwise_and(x1: NDArray, x2: NDArray | number): NDArray;
|
|
1777
|
+
/**
|
|
1778
|
+
* Bitwise OR element-wise
|
|
1779
|
+
*
|
|
1780
|
+
* @param x1 - First input array (must be integer type)
|
|
1781
|
+
* @param x2 - Second input array or scalar (must be integer type)
|
|
1782
|
+
* @returns Result of bitwise OR
|
|
1783
|
+
*/
|
|
1784
|
+
export declare function bitwise_or(x1: NDArray, x2: NDArray | number): NDArray;
|
|
1785
|
+
/**
|
|
1786
|
+
* Bitwise XOR element-wise
|
|
1787
|
+
*
|
|
1788
|
+
* @param x1 - First input array (must be integer type)
|
|
1789
|
+
* @param x2 - Second input array or scalar (must be integer type)
|
|
1790
|
+
* @returns Result of bitwise XOR
|
|
1791
|
+
*/
|
|
1792
|
+
export declare function bitwise_xor(x1: NDArray, x2: NDArray | number): NDArray;
|
|
1793
|
+
/**
|
|
1794
|
+
* Bitwise NOT (inversion) element-wise
|
|
1795
|
+
*
|
|
1796
|
+
* @param x - Input array (must be integer type)
|
|
1797
|
+
* @returns Result of bitwise NOT
|
|
1798
|
+
*/
|
|
1799
|
+
export declare function bitwise_not(x: NDArray): NDArray;
|
|
1800
|
+
/**
|
|
1801
|
+
* Invert (bitwise NOT) element-wise
|
|
1802
|
+
* Alias for bitwise_not
|
|
1803
|
+
*
|
|
1804
|
+
* @param x - Input array (must be integer type)
|
|
1805
|
+
* @returns Result of bitwise inversion
|
|
1806
|
+
*/
|
|
1807
|
+
export declare function invert(x: NDArray): NDArray;
|
|
1808
|
+
/**
|
|
1809
|
+
* Left shift elements by positions
|
|
1810
|
+
*
|
|
1811
|
+
* @param x1 - Input array (must be integer type)
|
|
1812
|
+
* @param x2 - Shift amount (array or scalar)
|
|
1813
|
+
* @returns Result of left shift
|
|
1814
|
+
*/
|
|
1815
|
+
export declare function left_shift(x1: NDArray, x2: NDArray | number): NDArray;
|
|
1816
|
+
/**
|
|
1817
|
+
* Right shift elements by positions
|
|
1818
|
+
*
|
|
1819
|
+
* @param x1 - Input array (must be integer type)
|
|
1820
|
+
* @param x2 - Shift amount (array or scalar)
|
|
1821
|
+
* @returns Result of right shift
|
|
1822
|
+
*/
|
|
1823
|
+
export declare function right_shift(x1: NDArray, x2: NDArray | number): NDArray;
|
|
1824
|
+
/**
|
|
1825
|
+
* Pack binary values into uint8 array
|
|
1826
|
+
*
|
|
1827
|
+
* Packs the elements of a binary-valued array into bits in a uint8 array.
|
|
1828
|
+
*
|
|
1829
|
+
* @param a - Input array (values are interpreted as binary: 0 or non-zero)
|
|
1830
|
+
* @param axis - The dimension over which bit-packing is done (default: -1)
|
|
1831
|
+
* @param bitorder - Order of bits: 'big' or 'little' (default: 'big')
|
|
1832
|
+
* @returns Packed uint8 array
|
|
1833
|
+
*/
|
|
1834
|
+
export declare function packbits(a: NDArray, axis?: number, bitorder?: 'big' | 'little'): NDArray;
|
|
1835
|
+
/**
|
|
1836
|
+
* Unpack uint8 array into binary values
|
|
1837
|
+
*
|
|
1838
|
+
* Unpacks elements of a uint8 array into a binary-valued output array.
|
|
1839
|
+
*
|
|
1840
|
+
* @param a - Input uint8 array
|
|
1841
|
+
* @param axis - The dimension over which bit-unpacking is done (default: -1)
|
|
1842
|
+
* @param count - Number of elements to unpack, or -1 for all (default: -1)
|
|
1843
|
+
* @param bitorder - Order of bits: 'big' or 'little' (default: 'big')
|
|
1844
|
+
* @returns Unpacked uint8 array of 0s and 1s
|
|
1845
|
+
*/
|
|
1846
|
+
export declare function unpackbits(a: NDArray, axis?: number, count?: number, bitorder?: 'big' | 'little'): NDArray;
|
|
1847
|
+
/**
|
|
1848
|
+
* Einstein summation convention
|
|
1849
|
+
*
|
|
1850
|
+
* Performs tensor contractions and reductions using Einstein notation.
|
|
1851
|
+
*
|
|
1852
|
+
* @param subscripts - Einstein summation subscripts (e.g., 'ij,jk->ik')
|
|
1853
|
+
* @param operands - Input arrays
|
|
1854
|
+
* @returns Result of the Einstein summation
|
|
1855
|
+
*
|
|
1856
|
+
* @example
|
|
1857
|
+
* // Matrix multiplication
|
|
1858
|
+
* einsum('ij,jk->ik', a, b)
|
|
1859
|
+
*
|
|
1860
|
+
* @example
|
|
1861
|
+
* // Inner product
|
|
1862
|
+
* einsum('i,i->', a, b)
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* // Trace
|
|
1866
|
+
* einsum('ii->', a)
|
|
1867
|
+
*/
|
|
1868
|
+
export declare function einsum(subscripts: string, ...operands: NDArray[]): NDArray | number | bigint;
|
|
1869
|
+
/**
|
|
1870
|
+
* Take values from the input array by matching 1d index and data slices along axis.
|
|
1871
|
+
*
|
|
1872
|
+
* @param arr - Input array
|
|
1873
|
+
* @param indices - Index array with same ndim as arr
|
|
1874
|
+
* @param axis - The axis along which to select values
|
|
1875
|
+
* @returns Array of values taken along the axis
|
|
1876
|
+
*/
|
|
1877
|
+
export declare function take_along_axis(arr: NDArray, indices: NDArray, axis: number): NDArray;
|
|
1878
|
+
/**
|
|
1879
|
+
* Put values into the destination array using 1d index and data slices along axis.
|
|
1880
|
+
*
|
|
1881
|
+
* @param arr - Destination array (modified in-place)
|
|
1882
|
+
* @param indices - Index array with same ndim as arr
|
|
1883
|
+
* @param values - Values to put
|
|
1884
|
+
* @param axis - The axis along which to put values
|
|
1885
|
+
*/
|
|
1886
|
+
export declare function put_along_axis(arr: NDArray, indices: NDArray, values: NDArray, axis: number): void;
|
|
1887
|
+
/**
|
|
1888
|
+
* Change elements of array based on conditional mask.
|
|
1889
|
+
*
|
|
1890
|
+
* @param a - Array to modify (in-place)
|
|
1891
|
+
* @param mask - Boolean mask array
|
|
1892
|
+
* @param values - Values to put where mask is True
|
|
1893
|
+
*/
|
|
1894
|
+
export declare function putmask(a: NDArray, mask: NDArray, values: NDArray | number | bigint): void;
|
|
1895
|
+
/**
|
|
1896
|
+
* Return selected slices of array along given axis.
|
|
1897
|
+
*
|
|
1898
|
+
* @param condition - Boolean array for selecting
|
|
1899
|
+
* @param a - Array from which to select
|
|
1900
|
+
* @param axis - Axis along which to select (if undefined, works on flattened array)
|
|
1901
|
+
* @returns Compressed array
|
|
1902
|
+
*/
|
|
1903
|
+
export declare function compress(condition: NDArray, a: NDArray, axis?: number): NDArray;
|
|
1904
|
+
/**
|
|
1905
|
+
* Return an array drawn from elements in choicelist, depending on conditions.
|
|
1906
|
+
*
|
|
1907
|
+
* @param condlist - List of boolean arrays (conditions)
|
|
1908
|
+
* @param choicelist - List of arrays to choose from
|
|
1909
|
+
* @param defaultVal - Default value when no condition is met (default 0)
|
|
1910
|
+
* @returns Array with selected values
|
|
1911
|
+
*/
|
|
1912
|
+
export declare function select(condlist: NDArray[], choicelist: NDArray[], defaultVal?: number | bigint): NDArray;
|
|
1913
|
+
/**
|
|
1914
|
+
* Change elements of an array based on conditional and input values.
|
|
1915
|
+
*
|
|
1916
|
+
* @param arr - Array to modify (in-place)
|
|
1917
|
+
* @param mask - Boolean mask array
|
|
1918
|
+
* @param vals - Values to place where mask is True (cycles if shorter)
|
|
1919
|
+
*/
|
|
1920
|
+
export declare function place(arr: NDArray, mask: NDArray, vals: NDArray): void;
|
|
1921
|
+
/**
|
|
1922
|
+
* Return the indices to access the main diagonal of an array.
|
|
1923
|
+
*
|
|
1924
|
+
* @param n - Size of arrays for which indices are returned
|
|
1925
|
+
* @param ndim - Number of dimensions (default 2)
|
|
1926
|
+
* @returns Tuple of index arrays
|
|
1927
|
+
*/
|
|
1928
|
+
export declare function diag_indices(n: number, ndim?: number): NDArray[];
|
|
1929
|
+
/**
|
|
1930
|
+
* Return the indices to access the main diagonal of an n-dimensional array.
|
|
1931
|
+
*
|
|
1932
|
+
* @param arr - Input array (must have all equal dimensions)
|
|
1933
|
+
* @returns Tuple of index arrays
|
|
1934
|
+
*/
|
|
1935
|
+
export declare function diag_indices_from(arr: NDArray): NDArray[];
|
|
1936
|
+
/**
|
|
1937
|
+
* Return the indices for the lower-triangle of an (n, m) array.
|
|
1938
|
+
*
|
|
1939
|
+
* @param n - Number of rows
|
|
1940
|
+
* @param k - Diagonal offset (0 = main, positive = above, negative = below)
|
|
1941
|
+
* @param m - Number of columns (default n)
|
|
1942
|
+
* @returns Tuple of row and column index arrays
|
|
1943
|
+
*/
|
|
1944
|
+
export declare function tril_indices(n: number, k?: number, m?: number): NDArray[];
|
|
1945
|
+
/**
|
|
1946
|
+
* Return the indices for the lower-triangle of arr.
|
|
1947
|
+
*
|
|
1948
|
+
* @param arr - Input 2-D array
|
|
1949
|
+
* @param k - Diagonal offset (0 = main, positive = above, negative = below)
|
|
1950
|
+
* @returns Tuple of row and column index arrays
|
|
1951
|
+
*/
|
|
1952
|
+
export declare function tril_indices_from(arr: NDArray, k?: number): NDArray[];
|
|
1953
|
+
/**
|
|
1954
|
+
* Return the indices for the upper-triangle of an (n, m) array.
|
|
1955
|
+
*
|
|
1956
|
+
* @param n - Number of rows
|
|
1957
|
+
* @param k - Diagonal offset (0 = main, positive = above, negative = below)
|
|
1958
|
+
* @param m - Number of columns (default n)
|
|
1959
|
+
* @returns Tuple of row and column index arrays
|
|
1960
|
+
*/
|
|
1961
|
+
export declare function triu_indices(n: number, k?: number, m?: number): NDArray[];
|
|
1962
|
+
/**
|
|
1963
|
+
* Return the indices for the upper-triangle of arr.
|
|
1964
|
+
*
|
|
1965
|
+
* @param arr - Input 2-D array
|
|
1966
|
+
* @param k - Diagonal offset (0 = main, positive = above, negative = below)
|
|
1967
|
+
* @returns Tuple of row and column index arrays
|
|
1968
|
+
*/
|
|
1969
|
+
export declare function triu_indices_from(arr: NDArray, k?: number): NDArray[];
|
|
1970
|
+
/**
|
|
1971
|
+
* Return the indices to access (n, n) arrays, given a masking function.
|
|
1972
|
+
*
|
|
1973
|
+
* @param n - The returned indices will be valid to access arrays of shape (n, n)
|
|
1974
|
+
* @param mask_func - A function that generates an (n, n) boolean mask
|
|
1975
|
+
* @param k - Optional diagonal offset passed to mask_func
|
|
1976
|
+
* @returns Tuple of row and column index arrays
|
|
1977
|
+
*/
|
|
1978
|
+
export declare function mask_indices(n: number, mask_func: (n: number, k: number) => NDArray, k?: number): NDArray[];
|
|
1979
|
+
/**
|
|
1980
|
+
* Return an array representing the indices of a grid.
|
|
1981
|
+
*
|
|
1982
|
+
* @param dimensions - The shape of the grid
|
|
1983
|
+
* @param dtype - Data type of result (default 'int32')
|
|
1984
|
+
* @returns Array of shape (len(dimensions), *dimensions)
|
|
1985
|
+
*/
|
|
1986
|
+
export declare function indices(dimensions: number[], dtype?: 'int32' | 'int64' | 'float64'): NDArray;
|
|
1987
|
+
/**
|
|
1988
|
+
* Construct an open mesh from multiple sequences.
|
|
1989
|
+
*
|
|
1990
|
+
* This function returns a list of arrays with shapes suitable for broadcasting.
|
|
1991
|
+
*
|
|
1992
|
+
* @param args - 1-D sequences
|
|
1993
|
+
* @returns Tuple of arrays for open mesh
|
|
1994
|
+
*/
|
|
1995
|
+
export declare function ix_(...args: NDArray[]): NDArray[];
|
|
1996
|
+
/**
|
|
1997
|
+
* Convert a tuple of index arrays into an array of flat indices.
|
|
1998
|
+
*
|
|
1999
|
+
* @param multi_index - Tuple of index arrays
|
|
2000
|
+
* @param dims - Shape of array into which indices apply
|
|
2001
|
+
* @param mode - How to handle out-of-bounds indices ('raise', 'wrap', 'clip')
|
|
2002
|
+
* @returns Flattened indices
|
|
2003
|
+
*/
|
|
2004
|
+
export declare function ravel_multi_index(multi_index: NDArray[], dims: number[], mode?: 'raise' | 'wrap' | 'clip'): NDArray;
|
|
2005
|
+
/**
|
|
2006
|
+
* Convert a flat index or array of flat indices into a tuple of coordinate arrays.
|
|
2007
|
+
*
|
|
2008
|
+
* @param indices - Array of indices or single index
|
|
2009
|
+
* @param shape - Shape of the array to index into
|
|
2010
|
+
* @param order - Row-major ('C') or column-major ('F') order
|
|
2011
|
+
* @returns Tuple of coordinate arrays
|
|
2012
|
+
*/
|
|
2013
|
+
export declare function unravel_index(indices: NDArray | number, shape: number[], order?: 'C' | 'F'): NDArray[];
|
|
1025
2014
|
//# sourceMappingURL=ndarray.d.ts.map
|