matrex v0.1.0 Matrex View Source

Performs fast operations on matrices using native C code and CBLAS library.

Link to this section Summary

Functions

Adds two matrices

Applies the given function on each element of the matrix

Applies function to elements of two matrices and returns matrix of function results

Returns the index of the biggest element

Get element of a matrix at given zero-based position

Divides two matrices

Matrix multiplication

Matrix multiplication

Matrix multiplication where the second matrix needs to be transposed

Matrix multiplication where the first matrix needs to be transposed

Create eye square matrix of given size

Create square matrix filled with given value

Create matrix filled with given value

Return first element of a matrix

Displays a visualization of the matrix. Set the second parameter to true to show full numbers. Otherwise, they are truncated

Creates “magic” n*n matrix, where sums of all dimensions are equal

Maximum element in a matrix

Elementwise multiplication of two matrices

Elementwise multiplication of a scalar

Creates new matrix from list of lists

Creates a new matrix with values provided by the given function

Create square matrix filled with ones

Create matrix filled with ones

Create square matrix of random floats

Create matrix of random floats in [0, 1] range

Return size of matrix as {rows, cols}

Substracts two matrices

Substracts the second matrix from the first

Sums all elements

Converts to flat list

Converts to list of lists

Transposes a matrix

Create square matrix of zeros

Create matrix of zeros of the specified size

Link to this section Functions

Link to this function add(first, second) View Source
add(binary(), binary()) :: binary()

Adds two matrices

Link to this function apply(matrix, c_math_function) View Source
apply(binary(), atom()) :: binary()
apply(binary(), function()) :: binary()
apply(binary(), function()) :: binary()
apply(binary(), function()) :: binary()

Applies the given function on each element of the matrix

Link to this function apply(first, second, function) View Source
apply(binary(), binary(), function()) :: binary()

Applies function to elements of two matrices and returns matrix of function results.

Returns the index of the biggest element.

Link to this function at(matrix, row, col) View Source
at(binary(), integer(), integer()) :: float()

Get element of a matrix at given zero-based position.

Link to this function divide(first, second) View Source
divide(binary(), binary()) :: binary()

Divides two matrices

Link to this function dot(first, second) View Source
dot(binary(), binary()) :: binary()

Matrix multiplication

Link to this function dot_and_add(first, second, third) View Source
dot_and_add(binary(), binary(), binary()) :: binary()

Matrix multiplication

Link to this function dot_nt(first, second) View Source
dot_nt(binary(), binary()) :: binary()

Matrix multiplication where the second matrix needs to be transposed.

Link to this function dot_tn(first, second) View Source
dot_tn(binary(), binary()) :: binary()

Matrix multiplication where the first matrix needs to be transposed.

Create eye square matrix of given size

Create square matrix filled with given value

Link to this function fill(rows, cols, value) View Source
fill(integer(), integer(), integer()) :: binary()

Create matrix filled with given value

Return first element of a matrix.

Link to this function inspect(matrix, full \\ false) View Source
inspect(binary(), boolean()) :: binary()

Displays a visualization of the matrix. Set the second parameter to true to show full numbers. Otherwise, they are truncated.

Creates “magic” n*n matrix, where sums of all dimensions are equal

Maximum element in a matrix.

Link to this function multiply(first, second) View Source
multiply(binary(), binary()) :: binary()

Elementwise multiplication of two matrices

Link to this function multiply_with_scalar(matrix, scalar) View Source
multiply_with_scalar(binary(), number()) :: binary()

Elementwise multiplication of a scalar

Link to this function new(list_of_lists) View Source
new([list()]) :: binary()

Creates new matrix from list of lists.

Creates a new matrix with values provided by the given function

Create square matrix filled with ones.

Create matrix filled with ones.

Create square matrix of random floats.

Link to this function random(rows, cols) View Source
random(integer(), integer()) :: binary()

Create matrix of random floats in [0, 1] range.

Return size of matrix as {rows, cols}

Link to this function substract(first, second) View Source
substract(binary(), binary()) :: binary()

Substracts two matrices

Link to this function substract_inverse(first, second) View Source
substract_inverse(binary(), binary()) :: binary()

Substracts the second matrix from the first

Sums all elements.

Link to this function to_list(matrix) View Source
to_list(binary()) :: binary()

Converts to flat list

Link to this function to_list_of_lists(matrix) View Source
to_list_of_lists(binary()) :: binary()

Converts to list of lists

Link to this function transpose(matrix) View Source
transpose(binary()) :: binary()

Transposes a matrix

Create square matrix of zeros

Create matrix of zeros of the specified size.