Interface

Vector

Vector

Members

number

# readonly size

The vector size

View Source vector.ts, line 128

# readonly type

The Vector type

View Source vector.ts, line 109

Methods

# delete()

Delete the underlying WASM instance. Should be called before dereferencing this object to prevent the WASM heap from growing indefinitely.

View Source vector.ts, line 54

# from(array, typeopt)

Converts a JS TypedArray into a vector
Parameters:
Name Type Attributes Description
array VectorTypes The TypedArray to convert
type StringTypes <optional>
An optional type override - useful for 'Modulus' only

View Source vector.ts, line 68

# getValue(index) → {number}

Get a value pointed to by the specified index
Parameters:
Name Type Description
index number Index of the Vector

View Source vector.ts, line 138

Value of the element in the Vector pointed to by the index
number

# resize(size, fill)

Resizes a vector to the given size
Parameters:
Name Type Description
size number number of elements to resize
fill number Data to fill the vector with

View Source vector.ts, line 154

# setType(type)

Set the Vector type
Parameters:
Name Type Description
type StringTypes the type of the vector

View Source vector.ts, line 118

# toArray() → {VectorTypes}

Copy a vector's data into a Typed Array Note: we cannot simply return a view on the underlying ArrayBuffer because WASM memory can grow and cause all the views to become neutered. We have to perform a hard copy to get data from WASM heap to JS.

View Source vector.ts, line 170

TypedArray containing values from the Vector
VectorTypes