Penelope v0.1.0 Penelope.ML.Vector

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

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 type t()
t() :: binary

Link to this section Functions

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

computes z = x + y

Link to this function empty()
empty() :: t

the empty vector

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

converts a list of floats to a vector

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

retrieves a vector element by 0-based index

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

computes y = ax

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

computes z = ax + y

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

calculates the number of elements in a vector

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

converts a vector to a list of floats

Link to this function zeros(n)
zeros(n :: non_neg_integer) :: t

creates a vector of length n containing all zeros