NDWasmArray

NDWasmArray

NDWasmArray

Constructor

new NDWasmArray(buffer, shape, dtype)

Source:
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:

matMul(other) → {NDWasmArray}

Description:
  • Matrix Multiplication: C = this * other

Source:
Parameters:
Name Type Description
other NDWasmArray | NDArray
Returns:
Type
NDWasmArray

matMulBatch(other) → {NDWasmArray}

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

Source:
Parameters:
Name Type Description
other NDWasmArray | NDArray
Returns:
Type
NDWasmArray

pull(disposeopt)

Description:
  • Pulls data from WASM to a JS-managed NDArray.

Source:
Parameters:
Name Type Attributes Default Description
dispose boolean <optional>
true

Release WASM memory after pulling.

(static) fromArray()

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.
Source: