Penelope v0.5.0 Penelope.ML.Vector View Source

This is a the vector library used by the ML modules. It provides an interface to an efficient binary representation of 32-bit floating point values. Math is done via the BLAS interface, wrapped in a NIF module.

Link to this section Summary

Functions

computes z = x + y

concatenates two vectors

the empty vector

converts a list of floats to a vector

retrieves a vector element by 0-based index

computes y = ax

computes z = ax + y

calculates the number of elements in a vector

converts a vector to a list of floats

creates a vector of length n containing all zeros

Link to this section Types

Link to this section Functions

Link to this function add(x, y) View Source
add(x :: t(), y :: t()) :: t()

computes z = x + y

Link to this function concat(x, y) View Source
concat(vector :: t(), vector :: t()) :: vector :: t()

concatenates two vectors

the empty vector

Link to this function from_list(numbers) View Source
from_list(numbers :: [float()]) :: t()

converts a list of floats to a vector

Link to this function get(vector, index) View Source
get(vector :: t(), index :: non_neg_integer()) :: float()

retrieves a vector element by 0-based index

Link to this function scale(x, a) View Source
scale(x :: t(), a :: float()) :: t()

computes y = ax

Link to this function scale_add(y, a, x) View Source
scale_add(y :: t(), a :: float(), x :: t()) :: t()

computes z = ax + y

Link to this function size(vector) View Source
size(vector :: t()) :: non_neg_integer()

calculates the number of elements in a vector

Link to this function to_list(vector) View Source
to_list(vector :: t()) :: [float()]

converts a vector to a list of floats

creates a vector of length n containing all zeros