Class: Vector

eclairjs/mllib/linalg. Vector

(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) → {number}

Gets the value of the ith element.
Parameters:
Name Type Description
i number index
Source:
Returns:
Type
number

argmax() → {integer}

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
integer

compressed() → {module:eclairjs/mllib/linalg.Vector}

Returns a vector in either dense or sparse format, whichever uses less storage.
Source:
Returns:
Type
module:eclairjs/mllib/linalg.Vector

copy() → {module:eclairjs/mllib/linalg.Vector}

Makes a deep copy of this vector.
Source:
Returns:
Type
module:eclairjs/mllib/linalg.Vector

equals(other) → {boolean}

Parameters:
Name Type Description
other object
Source:
Returns:
Type
boolean

hashCode() → {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
number

numActives() → {integer}

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
integer

numNonzeros() → {integer}

Number of nonzero elements. This scans all active values and count nonzeros.
Source:
Returns:
Type
integer

size() → {integer}

Size of the vector.
Source:
Returns:
Type
integer

toArray() → {Array.<float>}

Converts the instance to a double array.
Source:
Returns:
Type
Array.<float>

toDense() → {module:eclairjs/mllib/linalg.DenseVector}

Converts this vector to a dense vector.
Source:
Returns:
Type
module:eclairjs/mllib/linalg.DenseVector

toSparse() → {module:eclairjs/mllib/linalg.SparseVector}

Converts this vector to a sparse vector with all explicit zeros removed.
Source:
Returns:
Type
module:eclairjs/mllib/linalg.SparseVector