Back to Arrays
eye
Identity matrix.
Syntax
eye(n, cols) → n×n (or rows×cols) matrix with ones on the main diagonal
Backends
TypeScript
Description
Identity matrix.
Parameters
| Name | Description |
|---|---|
| n | Number of rows (square if cols omitted) |
| cols | Number of columns |
Returns
n×n (or rows×cols) matrix with ones on the main diagonal