elixir_linear_algebra v0.9.0 ELA.Vector

Contains operations for working with vectors.

Summary

Functions

Performs elementwise addition

Calculates the cross product. Is only defined for vectors with size three

Calculates the dot product. Multiplying empty vectors return 0

Performs elementwise multiplication between two vectors. This is the Hadmard product, but for vectors

Returns an empty vector with provided dimension

Calculates the norm of a vector

Elementwise multiplication with a scalar

Performs elementwise subtraction

Transponates the vector. Column vectors are two-dimensional

Functions

add(u, v)
add([number], [number]) :: [number]

Performs elementwise addition.

cross(u, v)
cross([number], [number]) :: [number]

Calculates the cross product. Is only defined for vectors with size three.

dot(u, v)
dot([number], [number]) :: number

Calculates the dot product. Multiplying empty vectors return 0.

hadmard(u, v)
hadmard([number], [number]) :: [number]

Performs elementwise multiplication between two vectors. This is the Hadmard product, but for vectors.

new(n)
new(number) :: [number]

Returns an empty vector with provided dimension.

norm(v)
norm([number]) :: number

Calculates the norm of a vector.

scalar(v, s)
scalar([number], number) :: [number]

Elementwise multiplication with a scalar.

sub(u, v)
sub([number], [number]) :: [number]
sub([number], [number]) :: [number]

Performs elementwise subtraction.

transp(v)

Transponates the vector. Column vectors are two-dimensional.