DADiSP Worksheet Functions > Function Categories > Generated Series > EYE

 

EYE

Purpose:

Generates an identity matrix.

Syntax:

EYE(numrows, numcols)

numrows

-

An integer. The number of output rows.

numcols

-

Optional. An integer, the number of output columns. Defaults to numrows.

Returns:

The NxN or NxM identity matrix.

Example:

eye(3)

 

creates the 3x3 matrix:

 

 {{1, 0, 0},

  {0, 1, 0},

  {0, 0, 1}}

Example:

eye(3,2)

 

creates the 3x2 matrix:

 

 {{1, 0},

  {0, 1},

  {0, 0}}

Remarks:

EYE uses DIAG to create the identity matrix.

See Also:

DIAGONAL

ONES

ZEROS