matrex v0.2.3 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

Get column of matrix as matrix (vector) in binary form

Get column of matrix as list of floats

Divides two matrices

Matrix multiplication

Matrix multiplication with addition of thitd matrix

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

Get row of matrix as matrix (vector) in binary form

Get row of matrix as list of floats

Return matrix row as list by zero-based index

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 Types

Link to this type t() View Source
t() :: %Matrex{data: binary()}

Link to this section Functions

Adds two matrices

Link to this function apply(matrix, function) View Source
apply(Matrex.t(), atom()) :: Matrex.t()
apply(Matrex.t(), function()) :: Matrex.t()
apply(Matrex.t(), function()) :: Matrex.t()
apply(Matrex.t(), function()) :: Matrex.t()

Applies the given function on each element of the matrix

Link to this function apply(matrex1, matrex2, function) View Source
apply(Matrex.t(), Matrex.t(), function()) :: Matrex.t()

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.

Get column of matrix as matrix (vector) in binary form.

Link to this function column_as_list(matrex, col) View Source
column_as_list(Matrex.t(), non_neg_integer()) :: [float()]

Get column of matrix as list of floats

Link to this function divide(matrex1, matrex2) View Source
divide(Matrex.t(), Matrex.t()) :: Matrex.t()

Divides two matrices

Matrix multiplication

Link to this function dot_and_add(matrex1, matrex2, matrex3) View Source
dot_and_add(Matrex.t(), Matrex.t(), Matrex.t()) :: Matrex.t()

Matrix multiplication with addition of thitd matrix

Link to this function dot_nt(matrex1, matrex2) View Source
dot_nt(Matrex.t(), Matrex.t()) :: Matrex.t()

Matrix multiplication where the second matrix needs to be transposed.

Link to this function dot_tn(matrex1, matrex2) View Source
dot_tn(Matrex.t(), Matrex.t()) :: Matrex.t()

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.

Link to this function inspect(matrex, full \\ false) View Source
inspect(Matrex.t(), boolean()) :: Matrex.t()

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(matrex1, matrex2) View Source
multiply(Matrex.t(), Matrex.t()) :: Matrex.t()

Elementwise multiplication of two matrices

Link to this function multiply_with_scalar(matrex, scalar) View Source
multiply_with_scalar(Matrex.t(), number()) :: Matrex.t()

Elementwise multiplication of a scalar

Link to this function new(list_of_lists) View Source
new([list()]) :: Matrex.t()

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.

Get row of matrix as matrix (vector) in binary form.

Link to this function row_as_list(matrex, row) View Source
row_as_list(Matrex.t(), non_neg_integer()) :: [float()]

Get row of matrix as list of floats

Link to this function row_to_list(matrex, row) View Source
row_to_list(Matrex.t(), non_neg_integer()) :: [float()]

Return matrix row as list by zero-based index.

Return size of matrix as {rows, cols}

Link to this function substract(matrex1, matrex2) View Source
substract(Matrex.t(), Matrex.t()) :: Matrex.t()

Substracts two matrices

Link to this function substract_inverse(first, second) View Source
substract_inverse(Matrex.t(), Matrex.t()) :: Matrex.t()

Substracts the second matrix from the first

Sums all elements.

Link to this function to_list(matrex) View Source
to_list(Matrex.t()) :: [float()]

Converts to flat list

Link to this function to_list_of_lists(matrex) View Source
to_list_of_lists(Matrex.t()) :: [[float()]]

Converts to list of lists

Link to this function transpose(matrex) View Source
transpose(Matrex.t()) :: Matrex.t()

Transposes a matrix

Create square matrix of zeros

Create matrix of zeros of the specified size.