eye

Syntax

eye(X)

Details

Return an X by X indentity matrix.

Difference from Python’s numpy.eye: numpy.eye can specify the number of rows and columns, diagonal offset, and dtype, and can generate rectangular matrices or matrices with an offset diagonal. DolphinDB’s eye only generates an n-by-n DOUBLE identity matrix.

Parameters

X is a positive integer.

Returns

A matrix of type DOUBLE.

Examples

eye(3);
#0 #1 #2
1 0 0
0 1 0
0 0 1