# View Source Descisionex.Helper(Descisionex v0.1.8)

Utility functions

# Link to this section Summary

## Functions

Average number for matrix row.

Calculate weights for matrix rows.

Find maximal criteria (row) in matrix (with index).

Find minimal criteria (row) in matrix (with index).

Normalizes matrix.

Matrix rounding to 3 numbers.

# avg(row, size)

View Source
`@spec avg(any(), number()) :: float()`

Average number for matrix row.

## examples Examples

``````iex> matrix = [[1, 2], [3, 4], [0, 1]]
iex> Enum.map(matrix, fn row -> Descisionex.Helper.avg(row, 2) end)
[1.5, 3.5, 0.5]``````

# calculate_weights(data, size)

View Source
`@spec calculate_weights(any(), any()) :: list()`

Calculate weights for matrix rows.

## examples Examples

``````iex> matrix = [[1, 2], [3, 4], [0, 1]]
iex> size = 2 # matrix row elements count
iex> Descisionex.Helper.calculate_weights(matrix, size)
[[1.5], [3.5], [0.5]]``````

# find_max_criteria(criteria)

View Source
`@spec find_max_criteria(any()) :: any()`

Find maximal criteria (row) in matrix (with index).

## examples Examples

``````iex> matrix = [[1, 2], [3, 4], [0, 1]]
iex> Descisionex.Helper.find_max_criteria(matrix)
{[3, 4], 1}``````

# find_min_criteria(criteria)

View Source
`@spec find_min_criteria(any()) :: any()`

Find minimal criteria (row) in matrix (with index).

## examples Examples

``````iex> matrix = [[1, 2], [3, 4], [0, 1]]
iex> Descisionex.Helper.find_min_criteria(matrix)
{[0, 1], 2}``````

# normalize(data, size)

View Source
`@spec normalize([[number()]], integer()) :: any()`

Normalizes matrix.

## examples Examples

``````iex> matrix = [[1, 2], [3, 4], [0, 1]]
iex> size = 3 # matrix rows
iex> Descisionex.Helper.normalize(matrix, size)
[[0.25, 0.286], [0.75, 0.571], [0.0, 0.143]]``````
`@spec round_matrix([[number()]]) :: list()`
``````iex> matrix = [[1/3, 2/3], [4/5, 5/6]]