(abstract) new Vector()
Represents a numeric vector, whose index type is Int and value type is Double.
Note: Users should not implement this interface.
- Source:
Methods
apply(i) → {Promise.<number>}
Gets the value of the ith element.
Parameters:
Name | Type | Description |
---|---|---|
i |
number | index |
- Source:
Returns:
- Type
- Promise.<number>
argmax() → {Promise.<number>}
Find the index of a maximal element. Returns the first maximal element in case of a tie.
Returns -1 if vector has length 0.
- Source:
Returns:
- Type
- Promise.<number>
compressed() → {module:eclairjs/mllib/linalg.Vector}
Returns a vector in either dense or sparse format, whichever uses less storage.
- Source:
Returns:
copy() → {module:eclairjs/mllib/linalg.Vector}
Makes a deep copy of this vector.
- Source:
Returns:
equals(other) → {Promise.<boolean>}
Parameters:
Name | Type | Description |
---|---|---|
other |
object |
- Source:
Returns:
- Type
- Promise.<boolean>
foreachActive(f) → {Promise.<Void>}
Applies a function `f` to all the active elements of dense and sparse vector.
Parameters:
Name | Type | Description |
---|---|---|
f |
func | the function takes two parameters where the first parameter is the index of the vector with type `Int`, and the second parameter is the corresponding value with type `Double`. |
- Source:
Returns:
A Promise that resolves to nothing.
- Type
- Promise.<Void>
hashCode() → {Promise.<number>}
Returns a hash code value for the vector. The hash code is based on its size and its first 128
nonzero entries, using a hash algorithm similar to hashCode.
- Source:
Returns:
- Type
- Promise.<number>
numActives() → {Promise.<number>}
Number of active entries. An "active entry" is an element which is explicitly stored,
regardless of its value. Note that inactive entries have value 0.
- Source:
Returns:
- Type
- Promise.<number>
numNonzeros() → {Promise.<number>}
Number of nonzero elements. This scans all active values and count nonzeros.
- Source:
Returns:
- Type
- Promise.<number>
size() → {Promise.<number>}
Size of the vector.
- Source:
Returns:
- Type
- Promise.<number>
toArray() → {Promise.<Array.<number>>}
Converts the instance to a double array.
- Source:
Returns:
- Type
- Promise.<Array.<number>>
toDense() → {module:eclairjs/mllib/linalg.DenseVector}
Converts this vector to a dense vector.
- Source:
Returns:
toJSON() → {Promise.<string>}
Converts the vector to a JSON string.
- Source:
Returns:
- Type
- Promise.<string>
toSparse() → {SparseVector}
Converts this vector to a sparse vector with all explicit zeros removed.
- Source:
Returns:
- Type
- SparseVector