# NDWasmArray

NDWasmArray

## Constructor

#### new NDWasmArray(buffer, shape, dtype)

Source:
  - ndwasmarray.js, line 14

##### Parameters:

Name | Type | Description
--- | --- | ---
`buffer` | WasmBuffer | The WASM memory bridge (contains .ptr and .view).
`shape` | Int32Array | Array | Dimensions of the array.
`dtype` | string | Data type (e.g., 'float64').

### Classes

NDWasmArray

### Methods

#### dispose()

Description:

  - Manually releases WASM heap memory.

Source:
  - ndwasmarray.js, line 118

#### matMul(right, result) → {NDWasmArray}

Description:

  - Matrix Multiplication: C = this * right

Source:
  - ndwasmarray.js, line 131

##### Parameters:

Name | Type | Description
--- | --- | ---
`right` | NDWasmArray |
`result` | NDWasmArray | Pre-allocated result array.

##### Returns:

the result array.

Type
  NDWasmArray

#### matMulBatch(other, result) → {NDWasmArray}

Description:

  - Batched Matrix Multiplication: C[i] = this[i] * other[i]

Source:
  - ndwasmarray.js, line 170

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | NDWasmArray |
`result` | NDWasmArray | Pre-allocated result array.

##### Returns:

Type
  NDWasmArray

#### pull(disposeopt)

Description:

  - Pulls data from WASM to a JS-managed NDArray.

Source:
  - ndwasmarray.js, line 105

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`dispose` | boolean | <optional> | `true` | Release WASM memory after pulling.

#### (static) fromArray(source, dtypeopt) → {NDWasmArray}

Description:

  - Static factory: Creates a WASM-resident array.

    1. If source is an NDArray, it calls .push() to move it to WASM.
    2. If source is a JS Array, it allocates WASM memory and fills it directly via recursive traversal to avoid intermediate flattening.
    3. If source is a single number, it creates a 1-element WASM array. Must dispose() manually to free WASM memory.
Source:
  - ndwasmarray.js, line 51

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`source` | NDArray | Array | number |  |  | Source data.
`dtype` | string | <optional> | `'float64'` | Data type.

##### Returns:

Type
  NDWasmArray

#### (static) newArray(shape, dtype) → {NDWasmArray}

Description:

  - Static factory: Creates an uninitialized WASM-resident array.

Source:
  - ndwasmarray.js, line 34

##### Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`shape` | * |  | Shape of the array.
`dtype` | * | `float64` | Data type.

##### Returns:

Type
  NDWasmArray