numpy-ts 0.6.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 +7 -9
- 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/ndarray.d.ts +263 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ops/advanced.d.ts +68 -0
- package/dist/types/ops/bitwise.d.ts +91 -0
- package/package.json +1 -1
|
@@ -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
|
|
@@ -1726,6 +1766,84 @@ export declare function remainder(x: NDArray, y: NDArray | number): NDArray;
|
|
|
1726
1766
|
* @returns Array with heaviside values (0 if x1 < 0, x2 if x1 == 0, 1 if x1 > 0)
|
|
1727
1767
|
*/
|
|
1728
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;
|
|
1729
1847
|
/**
|
|
1730
1848
|
* Einstein summation convention
|
|
1731
1849
|
*
|
|
@@ -1748,4 +1866,149 @@ export declare function heaviside(x1: NDArray, x2: NDArray | number): NDArray;
|
|
|
1748
1866
|
* einsum('ii->', a)
|
|
1749
1867
|
*/
|
|
1750
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[];
|
|
1751
2014
|
//# sourceMappingURL=ndarray.d.ts.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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, cumsum, cumprod, ptp, median, percentile, quantile, average, nansum, nanprod, nanmean, nanvar, nanstd, nanmin, nanmax, nanargmin, nanargmax, nancumsum, nancumprod, nanmedian, } 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, 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, } 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
|
|
@@ -37,4 +37,72 @@ export declare function choose(indexStorage: ArrayStorage, choices: ArrayStorage
|
|
|
37
37
|
* Check if two arrays are element-wise equal
|
|
38
38
|
*/
|
|
39
39
|
export declare function array_equal(a: ArrayStorage, b: ArrayStorage, equal_nan?: boolean): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Take values along an axis using 1D index array
|
|
42
|
+
*/
|
|
43
|
+
export declare function take_along_axis(storage: ArrayStorage, indices: ArrayStorage, axis: number): ArrayStorage;
|
|
44
|
+
/**
|
|
45
|
+
* Put values into array along an axis using 1D index array
|
|
46
|
+
*/
|
|
47
|
+
export declare function put_along_axis(storage: ArrayStorage, indices: ArrayStorage, values: ArrayStorage, axis: number): void;
|
|
48
|
+
/**
|
|
49
|
+
* Change elements of array based on conditional mask
|
|
50
|
+
*/
|
|
51
|
+
export declare function putmask(storage: ArrayStorage, mask: ArrayStorage, values: ArrayStorage | number | bigint): void;
|
|
52
|
+
/**
|
|
53
|
+
* Return selected slices along given axis based on condition
|
|
54
|
+
*/
|
|
55
|
+
export declare function compress(condition: ArrayStorage, storage: ArrayStorage, axis?: number): ArrayStorage;
|
|
56
|
+
/**
|
|
57
|
+
* Return array drawn from elements in choicelist, depending on conditions
|
|
58
|
+
*/
|
|
59
|
+
export declare function select(condlist: ArrayStorage[], choicelist: ArrayStorage[], defaultValue?: number | bigint): ArrayStorage;
|
|
60
|
+
/**
|
|
61
|
+
* Change elements of array based on conditional and input values
|
|
62
|
+
*/
|
|
63
|
+
export declare function place(storage: ArrayStorage, mask: ArrayStorage, vals: ArrayStorage): void;
|
|
64
|
+
/**
|
|
65
|
+
* Return indices to access main diagonal of array
|
|
66
|
+
*/
|
|
67
|
+
export declare function diag_indices(n: number, ndim?: number): ArrayStorage[];
|
|
68
|
+
/**
|
|
69
|
+
* Return indices to access main diagonal of array from given array
|
|
70
|
+
*/
|
|
71
|
+
export declare function diag_indices_from(storage: ArrayStorage): ArrayStorage[];
|
|
72
|
+
/**
|
|
73
|
+
* Return indices for lower-triangle of an (n, m) array
|
|
74
|
+
*/
|
|
75
|
+
export declare function tril_indices(n: number, k?: number, m?: number): ArrayStorage[];
|
|
76
|
+
/**
|
|
77
|
+
* Return indices for lower-triangle of given array
|
|
78
|
+
*/
|
|
79
|
+
export declare function tril_indices_from(storage: ArrayStorage, k?: number): ArrayStorage[];
|
|
80
|
+
/**
|
|
81
|
+
* Return indices for upper-triangle of an (n, m) array
|
|
82
|
+
*/
|
|
83
|
+
export declare function triu_indices(n: number, k?: number, m?: number): ArrayStorage[];
|
|
84
|
+
/**
|
|
85
|
+
* Return indices for upper-triangle of given array
|
|
86
|
+
*/
|
|
87
|
+
export declare function triu_indices_from(storage: ArrayStorage, k?: number): ArrayStorage[];
|
|
88
|
+
/**
|
|
89
|
+
* Return indices to access elements using mask function
|
|
90
|
+
*/
|
|
91
|
+
export declare function mask_indices(n: number, mask_func: (n: number, k: number) => ArrayStorage, k?: number): ArrayStorage[];
|
|
92
|
+
/**
|
|
93
|
+
* Return array representing indices of a grid
|
|
94
|
+
*/
|
|
95
|
+
export declare function indices(dimensions: number[], dtype?: 'int32' | 'int64' | 'float64'): ArrayStorage;
|
|
96
|
+
/**
|
|
97
|
+
* Construct open mesh from multiple sequences
|
|
98
|
+
*/
|
|
99
|
+
export declare function ix_(...args: ArrayStorage[]): ArrayStorage[];
|
|
100
|
+
/**
|
|
101
|
+
* Convert multi-dimensional index arrays to flat index array
|
|
102
|
+
*/
|
|
103
|
+
export declare function ravel_multi_index(multi_index: ArrayStorage[], dims: number[], mode?: 'raise' | 'wrap' | 'clip'): ArrayStorage;
|
|
104
|
+
/**
|
|
105
|
+
* Convert flat index array to tuple of coordinate arrays
|
|
106
|
+
*/
|
|
107
|
+
export declare function unravel_index(indices: ArrayStorage | number, shape: number[], order?: 'C' | 'F'): ArrayStorage[];
|
|
40
108
|
//# sourceMappingURL=advanced.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitwise operations
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for element-wise bitwise operations:
|
|
5
|
+
* bitwise_and, bitwise_or, bitwise_xor, bitwise_not, invert,
|
|
6
|
+
* left_shift, right_shift, packbits, unpackbits
|
|
7
|
+
*
|
|
8
|
+
* These operations only work on integer types.
|
|
9
|
+
*/
|
|
10
|
+
import { ArrayStorage } from '../core/storage';
|
|
11
|
+
/**
|
|
12
|
+
* Bitwise AND of two arrays or array and scalar
|
|
13
|
+
*
|
|
14
|
+
* @param a - First array storage (must be integer type)
|
|
15
|
+
* @param b - Second array storage or scalar (must be integer type)
|
|
16
|
+
* @returns Result storage
|
|
17
|
+
*/
|
|
18
|
+
export declare function bitwise_and(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
19
|
+
/**
|
|
20
|
+
* Bitwise OR of two arrays or array and scalar
|
|
21
|
+
*
|
|
22
|
+
* @param a - First array storage (must be integer type)
|
|
23
|
+
* @param b - Second array storage or scalar (must be integer type)
|
|
24
|
+
* @returns Result storage
|
|
25
|
+
*/
|
|
26
|
+
export declare function bitwise_or(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
27
|
+
/**
|
|
28
|
+
* Bitwise XOR of two arrays or array and scalar
|
|
29
|
+
*
|
|
30
|
+
* @param a - First array storage (must be integer type)
|
|
31
|
+
* @param b - Second array storage or scalar (must be integer type)
|
|
32
|
+
* @returns Result storage
|
|
33
|
+
*/
|
|
34
|
+
export declare function bitwise_xor(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
35
|
+
/**
|
|
36
|
+
* Bitwise NOT (invert) of each element
|
|
37
|
+
*
|
|
38
|
+
* @param a - Input array storage (must be integer type)
|
|
39
|
+
* @returns Result storage with bitwise NOT values
|
|
40
|
+
*/
|
|
41
|
+
export declare function bitwise_not(a: ArrayStorage): ArrayStorage;
|
|
42
|
+
/**
|
|
43
|
+
* Invert (bitwise NOT) - alias for bitwise_not
|
|
44
|
+
*
|
|
45
|
+
* @param a - Input array storage (must be integer type)
|
|
46
|
+
* @returns Result storage with inverted values
|
|
47
|
+
*/
|
|
48
|
+
export declare function invert(a: ArrayStorage): ArrayStorage;
|
|
49
|
+
/**
|
|
50
|
+
* Left shift of array elements
|
|
51
|
+
*
|
|
52
|
+
* @param a - Input array storage (must be integer type)
|
|
53
|
+
* @param b - Shift amount (array storage or scalar)
|
|
54
|
+
* @returns Result storage with left-shifted values
|
|
55
|
+
*/
|
|
56
|
+
export declare function left_shift(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
57
|
+
/**
|
|
58
|
+
* Right shift of array elements
|
|
59
|
+
*
|
|
60
|
+
* @param a - Input array storage (must be integer type)
|
|
61
|
+
* @param b - Shift amount (array storage or scalar)
|
|
62
|
+
* @returns Result storage with right-shifted values
|
|
63
|
+
*/
|
|
64
|
+
export declare function right_shift(a: ArrayStorage, b: ArrayStorage | number): ArrayStorage;
|
|
65
|
+
/**
|
|
66
|
+
* Pack binary values into uint8 array
|
|
67
|
+
*
|
|
68
|
+
* Packs the elements of a binary-valued array into bits in a uint8 array.
|
|
69
|
+
* The result has the same shape as the input, except for the specified axis
|
|
70
|
+
* which is divided by 8 (rounded up).
|
|
71
|
+
*
|
|
72
|
+
* @param a - Input array (values are interpreted as binary: 0 or non-zero)
|
|
73
|
+
* @param axis - The dimension over which bit-packing is done (default: -1, meaning the last axis)
|
|
74
|
+
* @param bitorder - The order of bits within each packed byte. 'big' means the most significant bit is first. (default: 'big')
|
|
75
|
+
* @returns Packed uint8 array
|
|
76
|
+
*/
|
|
77
|
+
export declare function packbits(a: ArrayStorage, axis?: number, bitorder?: 'big' | 'little'): ArrayStorage;
|
|
78
|
+
/**
|
|
79
|
+
* Unpack uint8 array into binary values
|
|
80
|
+
*
|
|
81
|
+
* Unpacks elements of a uint8 array into a binary-valued output array.
|
|
82
|
+
* Each element of the input array is unpacked into 8 binary values.
|
|
83
|
+
*
|
|
84
|
+
* @param a - Input uint8 array
|
|
85
|
+
* @param axis - The dimension over which bit-unpacking is done (default: -1, meaning the last axis)
|
|
86
|
+
* @param count - The number of elements to unpack along axis, or -1 for all (default: -1)
|
|
87
|
+
* @param bitorder - The order of bits within each packed byte. 'big' means the most significant bit is first. (default: 'big')
|
|
88
|
+
* @returns Unpacked uint8 array of 0s and 1s
|
|
89
|
+
*/
|
|
90
|
+
export declare function unpackbits(a: ArrayStorage, axis?: number, count?: number, bitorder?: 'big' | 'little'): ArrayStorage;
|
|
91
|
+
//# sourceMappingURL=bitwise.d.ts.map
|
package/package.json
CHANGED