ScranMatrix

ScranMatrix

Wrapper around a matrix allocated on the Wasm heap.

Classes

ScranMatrix

Methods

clone() → {ScranMatrix}

Source:
Returns:

A clone of the current ScranMatrix instance. This can be freed independently of the current instance.

Type
ScranMatrix

column(i, optionsopt) → {Float64Array|Float64WasmArray}

Source:
Parameters:
Name Type Attributes Default Description
i number

Index of the column to extract. This should be a non-negative integer less than numberOfColumns.

options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
asTypedArray boolean <optional>
true

Whether to return a Float64Array. If false, a Float64WasmArray is returned instead.

buffer Float64WasmArray <optional>
<nullable>
null

Buffer for storing the extracted data. If supplied, this should have length equal to numberOfRows.

Returns:

An array containing the contents of column i. If buffer is supplied, the function returns buffer if asTypedArray = false, or a view on buffer if asTypedArray = true.

Type
Float64Array | Float64WasmArray

free()

Source:

Free the memory on the Wasm heap for this.#matrix. This invalidates this object and all of its references.

isSparse() → {boolean}

Source:
Returns:

Whether the matrix is sparse.

Type
boolean

numberOfColumns() → {number}

Source:
Returns:

Number of columns in the matrix.

Type
number

numberOfRows() → {number}

Source:
Returns:

Number of rows in the matrix.

Type
number

row(i, optionsopt) → {Float64Array|Float64WasmArray}

Source:
Parameters:
Name Type Attributes Default Description
i number

Index of the row to extract. This should be a non-negative integer less than numberOfRows.

options object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
asTypedArray boolean <optional>
true

Whether to return a Float64Array. If false, a Float64WasmArray is returned instead.

buffer Float64WasmArray <optional>
<nullable>
null

Buffer for storing the extracted data. If supplied, this should have length equal to numberOfColumns.

Returns:

An array containing the contents of row i. If buffer is supplied, the function returns buffer if asTypedArray = false, or a view on buffer if asTypedArray = true.

Type
Float64Array | Float64WasmArray