numpy-ts 0.12.0 → 0.13.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 +18 -14
- package/dist/esm/common/broadcasting.js +1 -0
- package/dist/esm/common/complex.js +1 -0
- package/dist/esm/common/dtype.js +1 -0
- package/dist/esm/common/internal/compute.js +1 -0
- package/dist/esm/common/internal/indexing.js +1 -0
- package/dist/esm/common/ndarray-core.js +1 -0
- package/dist/esm/common/ops/advanced.js +1 -0
- package/dist/esm/common/ops/arithmetic.js +1 -0
- package/dist/esm/common/ops/bitwise.js +1 -0
- package/dist/esm/common/ops/comparison.js +1 -0
- package/dist/esm/common/ops/complex.js +1 -0
- package/dist/esm/common/ops/exponential.js +1 -0
- package/dist/esm/common/ops/fft.js +1 -0
- package/dist/esm/common/ops/formatting.js +2 -0
- package/dist/esm/common/ops/gradient.js +1 -0
- package/dist/esm/common/ops/hyperbolic.js +1 -0
- package/dist/esm/common/ops/linalg.js +2 -0
- package/dist/esm/common/ops/logic.js +1 -0
- package/dist/esm/common/ops/random.js +1 -0
- package/dist/esm/common/ops/reduction.js +1 -0
- package/dist/esm/common/ops/rounding.js +1 -0
- package/dist/esm/common/ops/sets.js +1 -0
- package/dist/esm/common/ops/shape.js +1 -0
- package/dist/esm/common/ops/sorting.js +1 -0
- package/dist/esm/common/ops/statistics.js +1 -0
- package/dist/esm/common/ops/trig.js +1 -0
- package/dist/esm/common/slicing.js +1 -0
- package/dist/esm/common/storage.js +1 -0
- package/dist/esm/core/advanced.js +1 -0
- package/dist/esm/core/arithmetic.js +1 -0
- package/dist/esm/core/bitwise.js +1 -0
- package/dist/esm/core/complex.js +1 -0
- package/dist/esm/core/creation.js +1 -0
- package/dist/esm/core/formatting.js +1 -0
- package/dist/esm/core/gradient.js +1 -0
- package/dist/esm/core/index.js +1 -0
- package/dist/esm/core/linalg.js +1 -0
- package/dist/esm/core/logic.js +1 -0
- package/dist/esm/core/polynomial.js +1 -0
- package/dist/esm/core/reduction.js +1 -0
- package/dist/esm/core/rounding.js +1 -0
- package/dist/esm/core/sets.js +1 -0
- package/dist/esm/core/shape-extra.js +1 -0
- package/dist/esm/core/shape.js +1 -0
- package/dist/esm/core/sorting.js +1 -0
- package/dist/esm/core/statistics.js +1 -0
- package/dist/esm/core/trig.js +1 -0
- package/dist/esm/core/typechecking.js +1 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/core/utility.js +1 -0
- package/dist/esm/core.js +1 -0
- package/dist/esm/full/index.js +1 -0
- package/dist/esm/full/ndarray.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/io/index.js +1 -0
- package/dist/esm/io/npy/format.js +1 -0
- package/dist/esm/io/npy/index.js +1 -0
- package/dist/esm/io/npy/parser.js +1 -0
- package/dist/esm/io/npy/serializer.js +2 -0
- package/dist/esm/io/npz/index.js +1 -0
- package/dist/esm/io/npz/parser.js +1 -0
- package/dist/esm/io/npz/serializer.js +1 -0
- package/dist/esm/io/txt/index.js +1 -0
- package/dist/esm/io/txt/parser.js +1 -0
- package/dist/esm/io/txt/serializer.js +2 -0
- package/dist/esm/io/zip/index.js +1 -0
- package/dist/esm/io/zip/reader.js +1 -0
- package/dist/esm/io/zip/types.js +1 -0
- package/dist/esm/io/zip/writer.js +1 -0
- package/dist/esm/node.js +1 -0
- package/dist/numpy-ts.browser.js +5 -2
- package/dist/numpy-ts.node-io.cjs +5 -3
- package/dist/numpy-ts.node-io.cjs.map +4 -4
- package/dist/numpy-ts.node-io.mjs +5 -3
- package/dist/numpy-ts.node-io.mjs.map +4 -4
- package/dist/numpy-ts.node.cjs +5 -2
- package/dist/numpy-ts.node.cjs.map +4 -4
- package/dist/types/common/complex.d.ts +94 -0
- package/dist/types/{internal → common/internal}/compute.d.ts +1 -1
- package/dist/types/{internal → common/internal}/indexing.d.ts +6 -0
- package/dist/types/common/ndarray-core.d.ts +126 -0
- package/dist/types/{ops → common/ops}/advanced.d.ts +2 -2
- package/dist/types/{ops → common/ops}/arithmetic.d.ts +1 -1
- package/dist/types/{ops → common/ops}/bitwise.d.ts +1 -1
- package/dist/types/{ops → common/ops}/comparison.d.ts +1 -1
- package/dist/types/{ops → common/ops}/complex.d.ts +1 -1
- package/dist/types/{ops → common/ops}/exponential.d.ts +1 -1
- package/dist/types/common/ops/fft.d.ts +166 -0
- package/dist/types/common/ops/formatting.d.ts +229 -0
- package/dist/types/{ops → common/ops}/gradient.d.ts +1 -1
- package/dist/types/{ops → common/ops}/hyperbolic.d.ts +1 -1
- package/dist/types/{ops → common/ops}/linalg.d.ts +24 -3
- package/dist/types/{ops → common/ops}/logic.d.ts +2 -2
- package/dist/types/common/ops/random.d.ts +376 -0
- package/dist/types/{ops → common/ops}/reduction.d.ts +2 -2
- package/dist/types/{ops → common/ops}/rounding.d.ts +1 -1
- package/dist/types/{ops → common/ops}/sets.d.ts +1 -1
- package/dist/types/{ops → common/ops}/shape.d.ts +1 -1
- package/dist/types/{ops → common/ops}/sorting.d.ts +1 -1
- package/dist/types/{ops → common/ops}/statistics.d.ts +1 -1
- package/dist/types/{ops → common/ops}/trig.d.ts +1 -1
- package/dist/types/{core → common}/storage.d.ts +1 -0
- package/dist/types/core/advanced.d.ts +54 -0
- package/dist/types/core/arithmetic.d.ts +110 -0
- package/dist/types/core/bitwise.d.ts +34 -0
- package/dist/types/core/complex.d.ts +15 -90
- package/dist/types/core/creation.d.ts +98 -0
- package/dist/types/core/formatting.d.ts +29 -0
- package/dist/types/core/gradient.d.ts +14 -0
- package/dist/types/core/index.d.ts +40 -0
- package/dist/types/core/linalg.d.ts +141 -0
- package/dist/types/core/logic.d.ts +72 -0
- package/dist/types/core/polynomial.d.ts +50 -0
- package/dist/types/core/reduction.d.ts +82 -0
- package/dist/types/core/rounding.d.ts +24 -0
- package/dist/types/core/sets.d.ts +48 -0
- package/dist/types/core/shape-extra.d.ts +24 -0
- package/dist/types/core/shape.d.ts +77 -0
- package/dist/types/core/sorting.d.ts +34 -0
- package/dist/types/core/statistics.d.ts +32 -0
- package/dist/types/core/trig.d.ts +58 -0
- package/dist/types/core/typechecking.d.ts +50 -0
- package/dist/types/core/types.d.ts +43 -0
- package/dist/types/core/utility.d.ts +30 -0
- package/dist/types/core.d.ts +30 -0
- package/dist/types/full/index.d.ts +603 -0
- package/dist/types/full/ndarray.d.ts +880 -0
- package/dist/types/index.d.ts +140 -26
- package/dist/types/io/npy/format.d.ts +1 -1
- package/dist/types/io/npy/parser.d.ts +3 -3
- package/dist/types/io/npy/serializer.d.ts +2 -2
- package/dist/types/io/npz/parser.d.ts +4 -4
- package/dist/types/io/npz/serializer.d.ts +6 -6
- package/dist/types/io/txt/parser.d.ts +5 -5
- package/dist/types/io/txt/serializer.d.ts +2 -2
- package/dist/types/node.d.ts +12 -8
- package/package.json +30 -29
- package/dist/numpy-ts.esm.js +0 -2
- package/dist/types/core/ndarray.d.ts +0 -3923
- package/dist/types/ops/random.d.ts +0 -136
- /package/dist/types/{core → common}/broadcasting.d.ts +0 -0
- /package/dist/types/{core → common}/dtype.d.ts +0 -0
- /package/dist/types/{core → common}/slicing.d.ts +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Complex number class for numpy-ts
|
|
3
|
+
*
|
|
4
|
+
* Represents complex numbers in JavaScript, similar to Python's complex type.
|
|
5
|
+
* Used when converting complex arrays to JavaScript values via toArray().
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Represents a complex number with real and imaginary parts.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const z = new Complex(1, 2); // 1 + 2i
|
|
13
|
+
* console.log(z.re); // 1
|
|
14
|
+
* console.log(z.im); // 2
|
|
15
|
+
* console.log(z.toString()); // "(1+2j)"
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class Complex {
|
|
19
|
+
/** Real part */
|
|
20
|
+
readonly re: number;
|
|
21
|
+
/** Imaginary part */
|
|
22
|
+
readonly im: number;
|
|
23
|
+
constructor(re: number, im?: number);
|
|
24
|
+
/**
|
|
25
|
+
* Returns the magnitude (absolute value) of the complex number.
|
|
26
|
+
* |z| = sqrt(re² + im²)
|
|
27
|
+
*/
|
|
28
|
+
abs(): number;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the phase angle (argument) of the complex number in radians.
|
|
31
|
+
* arg(z) = atan2(im, re)
|
|
32
|
+
*/
|
|
33
|
+
angle(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the complex conjugate.
|
|
36
|
+
* conj(a + bi) = a - bi
|
|
37
|
+
*/
|
|
38
|
+
conj(): Complex;
|
|
39
|
+
/**
|
|
40
|
+
* Add another complex number or real number.
|
|
41
|
+
*/
|
|
42
|
+
add(other: Complex | number): Complex;
|
|
43
|
+
/**
|
|
44
|
+
* Subtract another complex number or real number.
|
|
45
|
+
*/
|
|
46
|
+
sub(other: Complex | number): Complex;
|
|
47
|
+
/**
|
|
48
|
+
* Multiply by another complex number or real number.
|
|
49
|
+
* (a + bi)(c + di) = (ac - bd) + (ad + bc)i
|
|
50
|
+
*/
|
|
51
|
+
mul(other: Complex | number): Complex;
|
|
52
|
+
/**
|
|
53
|
+
* Divide by another complex number or real number.
|
|
54
|
+
* (a + bi) / (c + di) = ((ac + bd) + (bc - ad)i) / (c² + d²)
|
|
55
|
+
*/
|
|
56
|
+
div(other: Complex | number): Complex;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the negation of this complex number.
|
|
59
|
+
*/
|
|
60
|
+
neg(): Complex;
|
|
61
|
+
/**
|
|
62
|
+
* Check equality with another complex number.
|
|
63
|
+
*/
|
|
64
|
+
equals(other: Complex): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* String representation matching NumPy/Python format: "(a+bj)"
|
|
67
|
+
*/
|
|
68
|
+
toString(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Create a Complex from various input formats.
|
|
71
|
+
* Accepts:
|
|
72
|
+
* - Complex instance
|
|
73
|
+
* - {re, im} object
|
|
74
|
+
* - [re, im] array
|
|
75
|
+
* - number (creates re + 0i)
|
|
76
|
+
*/
|
|
77
|
+
static from(value: ComplexInput): Complex;
|
|
78
|
+
/**
|
|
79
|
+
* Check if a value is a complex number representation.
|
|
80
|
+
*/
|
|
81
|
+
static isComplex(value: unknown): value is ComplexInput;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Input types that can be converted to Complex.
|
|
85
|
+
*/
|
|
86
|
+
export type ComplexInput = Complex | {
|
|
87
|
+
re: number;
|
|
88
|
+
im?: number;
|
|
89
|
+
} | [number, number] | number;
|
|
90
|
+
/**
|
|
91
|
+
* Helper to check if a value looks like a complex number input.
|
|
92
|
+
*/
|
|
93
|
+
export declare function isComplexLike(value: unknown): value is ComplexInput;
|
|
94
|
+
//# sourceMappingURL=complex.d.ts.map
|
|
@@ -10,6 +10,12 @@ export declare function computeStrides(shape: readonly number[]): number[];
|
|
|
10
10
|
* Convert multi-index to linear index in row-major order
|
|
11
11
|
*/
|
|
12
12
|
export declare function multiIndexToLinear(indices: number[], shape: readonly number[]): number;
|
|
13
|
+
/**
|
|
14
|
+
* Convert multi-index to buffer position using actual strides and offset.
|
|
15
|
+
* Unlike multiIndexToLinear (which assumes C-contiguous layout),
|
|
16
|
+
* this works correctly for non-contiguous views/slices.
|
|
17
|
+
*/
|
|
18
|
+
export declare function multiIndexToBuffer(indices: number[], strides: readonly number[], offset: number): number;
|
|
13
19
|
/**
|
|
14
20
|
* Convert outer index and axis index to full multi-index
|
|
15
21
|
* Used in reductions along a specific axis
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NDArray Core - Minimal NDArray class for tree-shaking
|
|
3
|
+
*
|
|
4
|
+
* This module contains the minimal NDArray class without operation methods.
|
|
5
|
+
* It only depends on core modules (storage, dtype, slicing, complex) and
|
|
6
|
+
* does NOT import any ops modules.
|
|
7
|
+
*
|
|
8
|
+
* For the full NDArray with all methods, use ndarray-full.ts
|
|
9
|
+
*/
|
|
10
|
+
import { type DType, type TypedArray } from './dtype';
|
|
11
|
+
import { Complex } from './complex';
|
|
12
|
+
import { ArrayStorage } from './storage';
|
|
13
|
+
/**
|
|
14
|
+
* Minimal NDArray class - core functionality without operation methods
|
|
15
|
+
*
|
|
16
|
+
* This class provides:
|
|
17
|
+
* - Array properties (shape, dtype, data, etc.)
|
|
18
|
+
* - Element access (get, set, iget, iset)
|
|
19
|
+
* - Basic methods (copy, astype, fill, slice)
|
|
20
|
+
* - Conversion methods (toArray, tolist, tobytes)
|
|
21
|
+
*
|
|
22
|
+
* Operation methods (add, sin, reshape, etc.) are NOT included.
|
|
23
|
+
* Use NDArray from ndarray-full.ts for the complete API.
|
|
24
|
+
*/
|
|
25
|
+
export declare class NDArrayCore {
|
|
26
|
+
protected _storage: ArrayStorage;
|
|
27
|
+
protected _base?: NDArrayCore;
|
|
28
|
+
constructor(storage: ArrayStorage, base?: NDArrayCore);
|
|
29
|
+
/**
|
|
30
|
+
* Get internal storage (for ops modules)
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
get storage(): ArrayStorage;
|
|
34
|
+
/**
|
|
35
|
+
* Create NDArray from storage (for ops modules)
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
static fromStorage(storage: ArrayStorage, base?: NDArrayCore): NDArrayCore;
|
|
39
|
+
get shape(): readonly number[];
|
|
40
|
+
get ndim(): number;
|
|
41
|
+
get size(): number;
|
|
42
|
+
get dtype(): string;
|
|
43
|
+
get data(): TypedArray;
|
|
44
|
+
get strides(): readonly number[];
|
|
45
|
+
/**
|
|
46
|
+
* Array flags (similar to NumPy's flags)
|
|
47
|
+
*/
|
|
48
|
+
get flags(): {
|
|
49
|
+
C_CONTIGUOUS: boolean;
|
|
50
|
+
F_CONTIGUOUS: boolean;
|
|
51
|
+
OWNDATA: boolean;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Base array if this is a view, null if this array owns its data
|
|
55
|
+
*/
|
|
56
|
+
get base(): NDArrayCore | null;
|
|
57
|
+
/**
|
|
58
|
+
* Size of one array element in bytes
|
|
59
|
+
*/
|
|
60
|
+
get itemsize(): number;
|
|
61
|
+
/**
|
|
62
|
+
* Total bytes consumed by the elements of the array
|
|
63
|
+
*/
|
|
64
|
+
get nbytes(): number;
|
|
65
|
+
/**
|
|
66
|
+
* Fill the array with a scalar value (in-place)
|
|
67
|
+
*/
|
|
68
|
+
fill(value: number | bigint): void;
|
|
69
|
+
/**
|
|
70
|
+
* Iterator protocol - iterate over the first axis
|
|
71
|
+
*/
|
|
72
|
+
[Symbol.iterator](): Iterator<NDArrayCore | number | bigint | Complex>;
|
|
73
|
+
/**
|
|
74
|
+
* Get a single element from the array
|
|
75
|
+
*/
|
|
76
|
+
get(indices: number[]): number | bigint | Complex;
|
|
77
|
+
/**
|
|
78
|
+
* Set a single element in the array
|
|
79
|
+
*/
|
|
80
|
+
set(indices: number[], value: number | bigint | Complex | {
|
|
81
|
+
re: number;
|
|
82
|
+
im: number;
|
|
83
|
+
}): void;
|
|
84
|
+
/**
|
|
85
|
+
* Get element by flat index
|
|
86
|
+
*/
|
|
87
|
+
iget(flatIndex: number): number | bigint | Complex;
|
|
88
|
+
/**
|
|
89
|
+
* Set element by flat index
|
|
90
|
+
*/
|
|
91
|
+
iset(flatIndex: number, value: number | bigint | Complex): void;
|
|
92
|
+
/**
|
|
93
|
+
* Return a deep copy of the array
|
|
94
|
+
*/
|
|
95
|
+
copy(): NDArrayCore;
|
|
96
|
+
/**
|
|
97
|
+
* Cast array to a different dtype
|
|
98
|
+
*/
|
|
99
|
+
astype(dtype: DType, copy?: boolean): NDArrayCore;
|
|
100
|
+
/**
|
|
101
|
+
* Slice the array
|
|
102
|
+
*/
|
|
103
|
+
slice(...sliceStrs: string[]): NDArrayCore;
|
|
104
|
+
/**
|
|
105
|
+
* String representation
|
|
106
|
+
*/
|
|
107
|
+
toString(): string;
|
|
108
|
+
/**
|
|
109
|
+
* Convert to nested JavaScript array
|
|
110
|
+
*/
|
|
111
|
+
toArray(): unknown;
|
|
112
|
+
/**
|
|
113
|
+
* Return the array as a nested list (same as toArray)
|
|
114
|
+
*/
|
|
115
|
+
tolist(): unknown;
|
|
116
|
+
/**
|
|
117
|
+
* Return the raw bytes of the array data
|
|
118
|
+
*/
|
|
119
|
+
tobytes(): ArrayBuffer;
|
|
120
|
+
/**
|
|
121
|
+
* Copy an element of an array to a standard scalar and return it
|
|
122
|
+
*/
|
|
123
|
+
item(...args: number[]): number | bigint | Complex;
|
|
124
|
+
}
|
|
125
|
+
export type { DType, TypedArray };
|
|
126
|
+
//# sourceMappingURL=ndarray-core.d.ts.map
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Broadcasting, indexing, and comparison functions.
|
|
5
5
|
* @module ops/advanced
|
|
6
6
|
*/
|
|
7
|
-
import { ArrayStorage } from '../
|
|
8
|
-
import { broadcastShapes } from '../
|
|
7
|
+
import { ArrayStorage } from '../storage';
|
|
8
|
+
import { broadcastShapes } from '../broadcasting';
|
|
9
9
|
/**
|
|
10
10
|
* Broadcast an array to a given shape
|
|
11
11
|
* Returns a read-only view on the original array
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* These functions are used by NDArray methods but are separated
|
|
8
8
|
* to keep the codebase modular and testable.
|
|
9
9
|
*/
|
|
10
|
-
import { ArrayStorage } from '../
|
|
10
|
+
import { ArrayStorage } from '../storage';
|
|
11
11
|
/**
|
|
12
12
|
* Add two arrays or array and scalar
|
|
13
13
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* greater, greater_equal, less, less_equal, equal, not_equal,
|
|
6
6
|
* isclose, allclose
|
|
7
7
|
*/
|
|
8
|
-
import { ArrayStorage } from '../
|
|
8
|
+
import { ArrayStorage } from '../storage';
|
|
9
9
|
/**
|
|
10
10
|
* Element-wise greater than comparison (a > b)
|
|
11
11
|
* For complex: uses lexicographic ordering (real first, then imaginary)
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* These functions are used by NDArray methods but are separated
|
|
8
8
|
* to keep the codebase modular and testable.
|
|
9
9
|
*/
|
|
10
|
-
import { ArrayStorage } from '../
|
|
10
|
+
import { ArrayStorage } from '../storage';
|
|
11
11
|
/**
|
|
12
12
|
* Square root of each element
|
|
13
13
|
* NumPy behavior: Always promotes to float64 for integer types
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FFT (Fast Fourier Transform) operations
|
|
3
|
+
*
|
|
4
|
+
* Implements NumPy's np.fft module:
|
|
5
|
+
* - fft, ifft: 1D FFT
|
|
6
|
+
* - fft2, ifft2: 2D FFT
|
|
7
|
+
* - fftn, ifftn: N-dimensional FFT
|
|
8
|
+
* - rfft, irfft: Real FFT
|
|
9
|
+
* - rfft2, irfft2: 2D Real FFT
|
|
10
|
+
* - rfftn, irfftn: N-dimensional Real FFT
|
|
11
|
+
* - hfft, ihfft: Hermitian FFT
|
|
12
|
+
* - fftfreq, rfftfreq: FFT frequencies
|
|
13
|
+
* - fftshift, ifftshift: Shift zero-frequency to center
|
|
14
|
+
*
|
|
15
|
+
* @module ops/fft
|
|
16
|
+
*/
|
|
17
|
+
import { ArrayStorage } from '../storage';
|
|
18
|
+
/**
|
|
19
|
+
* Compute the 1-D discrete Fourier Transform.
|
|
20
|
+
*
|
|
21
|
+
* @param a - Input array storage
|
|
22
|
+
* @param n - Length of the transformed axis (default: length of a)
|
|
23
|
+
* @param axis - Axis along which to compute the FFT (default: -1, last axis)
|
|
24
|
+
* @param norm - Normalization mode: 'backward', 'ortho', or 'forward' (default: 'backward')
|
|
25
|
+
* @returns Complex array containing the FFT result
|
|
26
|
+
*/
|
|
27
|
+
export declare function fft(a: ArrayStorage, n?: number, axis?: number, norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
28
|
+
/**
|
|
29
|
+
* Compute the 1-D inverse discrete Fourier Transform.
|
|
30
|
+
*
|
|
31
|
+
* @param a - Input array storage
|
|
32
|
+
* @param n - Length of the transformed axis (default: length of a)
|
|
33
|
+
* @param axis - Axis along which to compute the IFFT (default: -1, last axis)
|
|
34
|
+
* @param norm - Normalization mode: 'backward', 'ortho', or 'forward' (default: 'backward')
|
|
35
|
+
* @returns Complex array containing the IFFT result
|
|
36
|
+
*/
|
|
37
|
+
export declare function ifft(a: ArrayStorage, n?: number, axis?: number, norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
38
|
+
/**
|
|
39
|
+
* Compute the 2-D discrete Fourier Transform.
|
|
40
|
+
*
|
|
41
|
+
* @param a - Input array storage
|
|
42
|
+
* @param s - Shape of the output (default: shape of input along axes)
|
|
43
|
+
* @param axes - Axes along which to compute the FFT (default: [-2, -1])
|
|
44
|
+
* @param norm - Normalization mode
|
|
45
|
+
* @returns Complex array containing the FFT result
|
|
46
|
+
*/
|
|
47
|
+
export declare function fft2(a: ArrayStorage, s?: [number, number], axes?: [number, number], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
48
|
+
/**
|
|
49
|
+
* Compute the 2-D inverse discrete Fourier Transform.
|
|
50
|
+
*
|
|
51
|
+
* @param a - Input array storage
|
|
52
|
+
* @param s - Shape of the output
|
|
53
|
+
* @param axes - Axes along which to compute the IFFT
|
|
54
|
+
* @param norm - Normalization mode
|
|
55
|
+
* @returns Complex array containing the IFFT result
|
|
56
|
+
*/
|
|
57
|
+
export declare function ifft2(a: ArrayStorage, s?: [number, number], axes?: [number, number], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
58
|
+
/**
|
|
59
|
+
* Compute the N-D discrete Fourier Transform.
|
|
60
|
+
*
|
|
61
|
+
* @param a - Input array storage
|
|
62
|
+
* @param s - Shape of the output along transform axes
|
|
63
|
+
* @param axes - Axes along which to compute the FFT
|
|
64
|
+
* @param norm - Normalization mode
|
|
65
|
+
* @returns Complex array containing the FFT result
|
|
66
|
+
*/
|
|
67
|
+
export declare function fftn(a: ArrayStorage, s?: number[], axes?: number[], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
68
|
+
/**
|
|
69
|
+
* Compute the N-D inverse discrete Fourier Transform.
|
|
70
|
+
*
|
|
71
|
+
* @param a - Input array storage
|
|
72
|
+
* @param s - Shape of the output along transform axes
|
|
73
|
+
* @param axes - Axes along which to compute the IFFT
|
|
74
|
+
* @param norm - Normalization mode
|
|
75
|
+
* @returns Complex array containing the IFFT result
|
|
76
|
+
*/
|
|
77
|
+
export declare function ifftn(a: ArrayStorage, s?: number[], axes?: number[], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
78
|
+
/**
|
|
79
|
+
* Compute the 1-D FFT of a real-valued array.
|
|
80
|
+
*
|
|
81
|
+
* @param a - Input array storage (real-valued)
|
|
82
|
+
* @param n - Length of the transformed axis
|
|
83
|
+
* @param axis - Axis along which to compute the FFT
|
|
84
|
+
* @param norm - Normalization mode
|
|
85
|
+
* @returns Complex array with length n//2 + 1 along the transformed axis
|
|
86
|
+
*/
|
|
87
|
+
export declare function rfft(a: ArrayStorage, n?: number, axis?: number, norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
88
|
+
/**
|
|
89
|
+
* Compute the inverse of rfft.
|
|
90
|
+
*
|
|
91
|
+
* @param a - Input array storage (from rfft)
|
|
92
|
+
* @param n - Length of the output along the transformed axis
|
|
93
|
+
* @param axis - Axis along which to compute the IFFT
|
|
94
|
+
* @param norm - Normalization mode
|
|
95
|
+
* @returns Real array
|
|
96
|
+
*/
|
|
97
|
+
export declare function irfft(a: ArrayStorage, n?: number, axis?: number, norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
98
|
+
/**
|
|
99
|
+
* Compute the 2-D FFT of a real-valued array.
|
|
100
|
+
*/
|
|
101
|
+
export declare function rfft2(a: ArrayStorage, s?: [number, number], axes?: [number, number], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
102
|
+
/**
|
|
103
|
+
* Compute the inverse of rfft2.
|
|
104
|
+
*/
|
|
105
|
+
export declare function irfft2(a: ArrayStorage, s?: [number, number], axes?: [number, number], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
106
|
+
/**
|
|
107
|
+
* Compute the N-D FFT of a real-valued array.
|
|
108
|
+
*/
|
|
109
|
+
export declare function rfftn(a: ArrayStorage, s?: number[], axes?: number[], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
110
|
+
/**
|
|
111
|
+
* Compute the inverse of rfftn.
|
|
112
|
+
*/
|
|
113
|
+
export declare function irfftn(a: ArrayStorage, s?: number[], axes?: number[], norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
114
|
+
/**
|
|
115
|
+
* Compute the FFT of a signal with Hermitian symmetry (real spectrum).
|
|
116
|
+
*
|
|
117
|
+
* @param a - Input array with Hermitian symmetry
|
|
118
|
+
* @param n - Length of the output
|
|
119
|
+
* @param axis - Axis along which to compute
|
|
120
|
+
* @param norm - Normalization mode
|
|
121
|
+
* @returns Real array
|
|
122
|
+
*/
|
|
123
|
+
export declare function hfft(a: ArrayStorage, n?: number, axis?: number, norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
124
|
+
/**
|
|
125
|
+
* Compute the inverse of hfft.
|
|
126
|
+
*
|
|
127
|
+
* @param a - Input real array
|
|
128
|
+
* @param n - Length of the Hermitian output
|
|
129
|
+
* @param axis - Axis along which to compute
|
|
130
|
+
* @param norm - Normalization mode
|
|
131
|
+
* @returns Complex array with Hermitian symmetry
|
|
132
|
+
*/
|
|
133
|
+
export declare function ihfft(a: ArrayStorage, n?: number, axis?: number, norm?: 'backward' | 'ortho' | 'forward'): ArrayStorage;
|
|
134
|
+
/**
|
|
135
|
+
* Return the Discrete Fourier Transform sample frequencies.
|
|
136
|
+
*
|
|
137
|
+
* @param n - Window length
|
|
138
|
+
* @param d - Sample spacing (default: 1.0)
|
|
139
|
+
* @returns Array of length n containing the sample frequencies
|
|
140
|
+
*/
|
|
141
|
+
export declare function fftfreq(n: number, d?: number): ArrayStorage;
|
|
142
|
+
/**
|
|
143
|
+
* Return the Discrete Fourier Transform sample frequencies for rfft.
|
|
144
|
+
*
|
|
145
|
+
* @param n - Window length
|
|
146
|
+
* @param d - Sample spacing (default: 1.0)
|
|
147
|
+
* @returns Array of length n//2 + 1 containing the sample frequencies
|
|
148
|
+
*/
|
|
149
|
+
export declare function rfftfreq(n: number, d?: number): ArrayStorage;
|
|
150
|
+
/**
|
|
151
|
+
* Shift the zero-frequency component to the center of the spectrum.
|
|
152
|
+
*
|
|
153
|
+
* @param a - Input array
|
|
154
|
+
* @param axes - Axes over which to shift (default: all axes)
|
|
155
|
+
* @returns Shifted array
|
|
156
|
+
*/
|
|
157
|
+
export declare function fftshift(a: ArrayStorage, axes?: number | number[]): ArrayStorage;
|
|
158
|
+
/**
|
|
159
|
+
* Inverse of fftshift.
|
|
160
|
+
*
|
|
161
|
+
* @param a - Input array
|
|
162
|
+
* @param axes - Axes over which to shift (default: all axes)
|
|
163
|
+
* @returns Shifted array
|
|
164
|
+
*/
|
|
165
|
+
export declare function ifftshift(a: ArrayStorage, axes?: number | number[]): ArrayStorage;
|
|
166
|
+
//# sourceMappingURL=fft.d.ts.map
|