ee.Array.identity

Stay organized with collections Save and categorize content based on your preferences.
Creates a 2D identity matrix of the given size.

UsageReturns
ee.Array.identity(size)Array
ArgumentTypeDetails
sizeIntegerThe length of each axis.

Examples

Code Editor (JavaScript)

// []
print(ee.Array.identity(0));

// [[1]]
print(ee.Array.identity(1));

// [[1,0],
//  [0,1]]
print(ee.Array.identity(2));

// [[1,0,0],
//  [0,1,0],
//  [0,0,1]]
print(ee.Array.identity(3));