Skip to content

Latest commit

 

History

History
305 lines (134 loc) · 4.07 KB

File metadata and controls

305 lines (134 loc) · 4.07 KB

Home > @josh-brown/vector > FloatVector

FloatVector class

A dense Vector of numbers implemented as a Float64Array

Signature:

export declare class FloatVector implements Vector<number> 

Implements: Vector<number>

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the FloatVector class.

Methods

Method

Modifiers

Description

add(other)

Implements vector addition

builder()

Returns a VectorBuilder which will build new vectors of the same type

builder()

static

combine(other, combineEntries)

Returns the dimension of the vector

equals(other)

Tests if two vectors are equal

forEach(callback)

Returns the dimension of the vector

getDimension()

Returns the dimension of the vector

getEntry(index)

Returns the entry of the matrix located at the provided index (index)

getSparseData()

Returns the contents of the vector as a map of indices to nonzero values

innerProduct(other)

Implements the inner product (scalar product or dot product) of two vectors

map(valueFromEntry)

Returns the dimension of the vector

matrixBuilder()

Returns a MatrixBuilder which will build new matrices of a compatible type

ops()

Returns a ScalarOperations object which will allow consumers to work generically with the scalars contained in the vector.

ops()

static

outerProduct(other)

Implements the outer product (matrix product) of two vectors

projectOnto(u)

Returns a new vector in the direction of u but with magnitude equal to the amount of the original vector that lies in that direction

scalarMultiply(scalar)

Implements vector multiplication by a scalar

set(index, value)

Returns a new vector equal to the old one, except with the entry at index replaced with value

toArray()

Returns the contents of the vector as an array