Skip to content
Ubiquev1.0.4
classDenseMatrix

An f64 matrix resident in WASM memory. Storage is column-major: view()[column * rows + row]. Fill the view directly to avoid a JS-to-WASM input copy; use multiplyInto to reuse output storage across calculations.

A view is a short-lived borrow: reacquire it after ANY WASM allocation/call that may grow memory, and never use it after dispose(). Do not retain views across async boundaries. toArray() returns an independent copy.

Constructors

DenseMatrix(
rows: number,
cols: number
)

Static Methods

from(a: number[][]): DenseMatrix

Copy nested row-major input once into persistent column-major storage.

Properties

readonly
cols: number
readonly
rows: number

Methods

dispose(): void

Release WASM storage. Repeated disposal is harmless.

Multiply without JS input/output copies, overwriting a distinct output.

setData(
data: Float64Array,
layout?: "row-major" | "column-major"
): this

Replace values from a typed buffer without allocating WASM storage.

toArray(): number[][]

Copy results out only when needed by the application.

view(): Float64Array

Borrow the current memory view; see the class lifetime contract.