Members
Methods
# delete()
Delete the underlying WASM instance.
Should be called before dereferencing this object to prevent the
WASM heap from growing indefinitely.
# 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 |
# getValue(index) → {number}
Get a value pointed to by the specified index
Parameters:
Name | Type | Description |
---|---|---|
index |
number
|
Index of the Vector |
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 |
# setType(type)
Set the Vector type
Parameters:
Name | Type | Description |
---|---|---|
type |
StringTypes
|
the type of the vector |
# 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.
TypedArray containing values from the Vector
VectorTypes