Iden

iden is a function that computes the identity matrix of the desired size, which is either full or sparse.

Syntax

 * ID = iden(DIM,SP)

Argument descriptions

 * DIM: The number of rows (or equivalently, columns) that ID will have.
 * SP: A flag (either 1 or 0) indicating whether ID should or should not be sparse.

Examples
Full and sparse versions of the 2-by-2 identity matrix: