ExMatrix.Generators
ExMatrix.Generators provides functions for creating matrices and parts of matrices
Examples
# Generate a filled row with one cell set
ExMatrix.Generators.generate_filled_row(5, 1, 3) == [0, 0, 1, 0, 0]
# Generate a zero filled row
ExMatrix.Generators.generate_zero_row(4) == [0, 0, 0, 0]
Summary↑
generate_filled_row(columns, value, col) | Generates a row of |
generate_partial_matrix(value, row, column, cells) | Generates a matrix of |
generate_zero_row(columns) | Generates a zero filled row of |
Functions
Generates a row of columns
length which is zero filled apart from the element at position col
which will have the value value
.
iex> ExMatrix.Generators.generate_filled_row(5, 1, 3)
[0, 0, 1, 0, 0]
Generates a matrix of cells
size settings every cell to 0 except for the cell at row, column
which will be set to value
iex> ExMatrix.Generators.generate_partial_matrix(100, 1, 1, 10)
[[100, 0, 0], [0, 0, 0], [0, 0, 0]]
Generates a zero filled row of columns
length
iex> ExMatrix.Generators.generate_zero_row(3)
[0, 0, 0]