Skip to content

Latest commit

 

History

History
226 lines (99 loc) · 3.19 KB

File metadata and controls

226 lines (99 loc) · 3.19 KB

Home > @josh-brown/vector > VectorBuilder

VectorBuilder class

Provides methods for constructing Vectors of a given type

Signature:

export declare class VectorBuilder<S, V extends Vector<S>> 

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 VectorBuilder class.

Methods

Method

Modifiers

Description

concatenate(first, second)

Constructs a vector consisting of two vectors end-to-end

elementaryVector(dimension, oneIndex)

Constructs a vector that has the value 1 at one index, and 0 at the others

empty()

Constructs a Vector of dimension 0

fill(value, dimension)

Constructs a vector whose entries are all equal to the provided value

fromArray(data)

fromIndexFunction(dimension, valueFromIndex)

Constructs a vector with entries given by _entry = f(i)_ where _f_ is valueFromIndex and i is the index of the element

fromNumberArray(data)

fromSparseData(dimension, sparseData)

fromValues(data)

ones(dimension)

Constructs a vector of all ones

random(dimension, min, max)

Constructs a vector whose entries are (uniformly-distributed) random numbers between min and max

randomNormal(dimension, mean, standardDeviation)

Constructs a vector whose entries are normally distributed, with the specified mean and standard deviation

shift(vector, offset, reverse)

Constructs a vector whose entries match the input vector, but offset by a given amount

zeros(dimension)

Constructs a vector of all zeros