# NDWasmSignal

## Namespace

#### NDWasmSignal

Description:

  - NDWasmSignal: Signal Processing & Transformations Handles O(n log n) frequency domain transforms and O(n^2 * k^2) spatial filters.

Source:
  - ndwasm_signal.js, line 3

### Methods

#### (static) conv2d(img, kernel, stride, padding) → {NDArray}

Description:

  - 2D Spatial Convolution. Complexity: O(img_h * img_w * kernel_h * kernel_w)

Source:
  - ndwasm_signal.js, line 190

##### 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:
  - ndwasm_signal.js, line 214

##### 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:
  - ndwasm_signal.js, line 169

##### 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:
  - ndwasm_signal.js, line 18

##### 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:
  - ndwasm_signal.js, line 122

##### 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:
  - ndwasm_signal.js, line 44

##### 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:
  - ndwasm_signal.js, line 146

##### 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:
  - ndwasm_signal.js, line 69

##### 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:
  - ndwasm_signal.js, line 96

##### 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