Semagle.Numerics.Vectors Library
The library provides two DenseVector
and SparseVector
with corresponding operations,
which are commonly used in machine learning applications.
Creating Vectors
DenseVector
is constructed from the array of float32
values.
This type of vector stores zero and nonzero values and suits well for feature
vectors with many nonzero elements.
1: 2: 

SparseVector
is constructed from the array of int
indices of nonzero elements
and the array of float32
values of nonzero elements. This type of vector suits well
for feature vectors with a few nonzero elements.
1: 2: 

Operations
Indexing and Slicing
DenseVector
and SparseVector
support indexing and slicing operations, but
implementations of SparseVector
operations are more expensive because they require
binary search for finding item indeces.
1: 2: 3: 4: 

Elementwise Operations
DenseVector
and SparseVector
support element wise addition, subtraction, multiplication and division.
1: 2: 3: 4: 

Negation and Multiplication/Division by Scalar
DenseVector
and SparseVector
support unary negation and multiplication/division by scalar.
1: 2: 3: 

Dot/Inner Product
Dot product is a key operation of many machine learning algoritms and DenseVector
and SparseVector
provide the effective implementations of this operation.
1:


Full name: index.a
Full name: index.a