Chi2fit.Matrix.unit

You're seeing just the function unit, go back to Chi2fit.Matrix module for more information.

Specs

unit(n :: pos_integer()) :: [[0 | 1]]

Constructs a unit matrix of size n. All diagonal elements have value 1 and the rest has value 0.

Examples

iex> unit(3)
[[1, 0, 0], [0, 1, 0], [0, 0, 1]]

iex> unit(0)
** (ArgumentError) Illegal argument '0'

iex> unit -1
** (ArgumentError) Illegal argument '-1'

iex> unit 1.3
** (ArgumentError) Illegal argument '1.3'