Identity matrix

From Fōrmulæ wiki
Jump to: navigation, search

This page is the answer to the task Identity matrix in the Rosetta Code.

Description (from Rosetta Code)

Task

Build an identity matrix of a size known at run-time.

An identity matrix is a square matrix of size n × n, where the diagonal elements are all 1s (ones), and all the other elements are all 0s (zeroes).


Program

IdentityMatrixProgram.png

Example

IdentityMatrixExample.png