identity-matrix ( n -- matrix )


Vocabulary
math.matrices

Inputs and outputs
nan integer
matrixa sequence


Word description
Creates an identity matrix of size n x n, where the diagonal values are all ones.

Definition
USING: sequences ;

IN: math.matrices

: identity-matrix ( n -- matrix )
1 <repetition> diagonal-matrix ; inline