NDWasmSignal
- Description:
NDWasmSignal: Signal Processing & Transformations Handles O(n log n) frequency domain transforms and O(n^2 * k^2) spatial filters.
- Source:
Methods
(static) conv2d(img, kernel, stride, padding) → {NDArray}
- Description:
2D Spatial Convolution. Complexity: O(img_h * img_w * kernel_h * kernel_w)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
img |
NDArray | 2D Image/Matrix. |
kernel |
NDArray | 2D Filter kernel. |
stride |
number | Step size (default 1). |
padding |
number | Zero-padding size (default 0). |
Returns:
Convolved result.
- Type
- NDArray
(static) correlate2d(img, kernel, stride, padding) → {NDArray}
- Description:
2D Spatial Cross-Correlation. Similar to convolution but without flipping the kernel. Complexity: O(img_h * img_w * kernel_h * kernel_w)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
img |
NDArray | 2D Image/Matrix. |
kernel |
NDArray | 2D Filter kernel. |
stride |
number | Step size. |
padding |
number | Zero-padding size. |
Returns:
Cross-correlated result.
- Type
- NDArray
(static) dct(a) → {NDArray}
- Description:
1D Discrete Cosine Transform (Type II). Complexity: O(n log n)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | Input signal. |
Returns:
DCT result of same shape.
- Type
- NDArray
(static) fft(a) → {NDArray}
- Description:
1D Complex-to-Complex Fast Fourier Transform. The input array must have its last dimension of size 2 (real and imaginary parts). The transform is performed in-place. Complexity: O(n log n)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | Complex input signal, with shape [..., 2]. |
Returns:
- Complex result, with the same shape as input.
- Type
- NDArray
(static) fft2(a) → {NDArray}
- Description:
2D Complex-to-Complex Fast Fourier Transform. The input array must be 3D with shape [rows, cols, 2]. The transform is performed in-place. Complexity: O(rows * cols * log(rows * cols))
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | 2D Complex input signal, with shape [rows, cols, 2]. |
Returns:
- 2D Complex result, with the same shape as input.
- Type
- NDArray
(static) ifft(a) → {NDArray}
- Description:
1D Inverse Complex-to-Complex Fast Fourier Transform. The input array must have its last dimension of size 2 (real and imaginary parts). The transform is performed in-place. Complexity: O(n log n)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | Complex frequency-domain signal, with shape [..., 2]. |
Returns:
- Complex time-domain result, with the same shape as input.
- Type
- NDArray
(static) ifft2(a) → {NDArray}
- Description:
2D Inverse Complex-to-Complex Fast Fourier Transform. The input array must be 3D with shape [rows, cols, 2]. The transform is performed in-place.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | 2D Complex frequency-domain signal, with shape [rows, cols, 2]. |
Returns:
- 2D Complex time-domain result, with the same shape as input.
- Type
- NDArray
(static) rfft(a) → {NDArray}
- Description:
1D Real-to-Complex Fast Fourier Transform (Optimized for real input). The output is a complex array with shape [n/2 + 1, 2]. Complexity: O(n log n)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | Real input signal. |
Returns:
- Complex result of shape [n/2 + 1, 2].
- Type
- NDArray
(static) rifft(a, n) → {NDArray}
- Description:
1D Complex-to-Real Inverse Fast Fourier Transform. The input must be a complex array of shape [k, 2], where k is n/2 + 1.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
a |
NDArray | Complex frequency signal of shape [n/2 + 1, 2]. |
n |
number | Length of the original real signal. |
Returns:
Real-valued time domain signal.
- Type
- NDArray