ee.Array.eigen

Computes the real eigenvectors and eigenvalues of a square 2D array of A rows and A columns. Returns an array with A rows and A+1 columns, where each row contains an eigenvalue in the first column, and the corresponding eigenvector in the remaining A columns. The rows are sorted by eigenvalue, in descending order.

UsageReturns
Array.eigen()Array
ArgumentTypeDetails
this: inputArray

A square, 2D array from which to compute the eigenvalue decomposition.

Examples

JavaScript

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

print(ee.Array([[1, 0], [0, 0]]).eigen());  // [[1,1,0],[0,0,1]]
print(ee.Array([[0, 1], [0, 0]]).eigen());  // [[0,0,1],[0,1,0]]
print(ee.Array([[0, 0], [1, 0]]).eigen());  // [[0,-1,0],[0,0,-1]]
print(ee.Array([[0, 0], [0, 1]]).eigen());  // [[1,0,1],[0,1,0]]

print(ee.Array([[1, 1], [0, 0]]).eigen());  // [[1,1,0],[0,-1/√2,1/√2]]
print(ee.Array([[0, 0], [1, 1]]).eigen());  // [[1,0,-1],[0,-1/√2,1/√2]]]

print(ee.Array([[1, 0], [1, 0]]).eigen());  // [[1,1/√2,1/√2],[0,0,1]]
print(ee.Array([[1, 0], [0, 1]]).eigen());  // [[1,1,0],[1,0,1]]
print(ee.Array([[0, 1], [1, 0]]).eigen());  // [[1,1/√2,1/√2],[-1,1/√2,-1/√2]]
print(ee.Array([[0, 1], [0, 1]]).eigen());  // [[1,1/√2,1/√2],[0,1,0]]

print(ee.Array([[1, 1], [1, 0]]).eigen());  // [[1.62,0.85,0.53],[-0.62,0.53]]
print(ee.Array([[1, 1], [0, 1]]).eigen());  // [[1,0,1],[1,1,0]]
print(ee.Array([[1, 0], [1, 1]]).eigen());  // [[1,-1,0],[1,0,-1]]
// [[1.62,-0.53,-0.85],[-0.62,-0.85,0.53]]
print(ee.Array([[0, 1], [1, 1]]).eigen());

print(ee.Array([[1, 1], [1, 1]]).eigen());  // [[2,1/√2,1/√2],[0,1/√2,-1/√2]]

var matrix = ee.Array([
  [1, 0, 0],
  [0, 1, 0],
  [0, 0, 1]]);
print(matrix.eigen());  // [[1,1,0,0],[1,0,1,0],[1,0,0,1]]

var matrix = ee.Array([
  [2, 0, 0],
  [0, 3, 0],
  [0, 0, 4]]);
print(matrix.eigen());  // [[4,0,0,1],[3,0,1,0],[2,1,0,0]]

matrix = ee.Array([
  [1, 0, 0],
  [0, 0, 0],
  [0, 0, 0]]);
print(matrix.eigen());  // [[1,1,0,0],[0,0,1,0],[0,0,0,1]]

matrix = ee.Array([
  [1, 1, 1],
  [1, 1, 1],
  [1, 1, 1]]);
// [[3,-0.58,-0.58,-0.58],[0,0,-1/√2,1/√2],[0,-0.82,0.41,0.41]]
print(matrix.eigen());

Python

# Your example goes here!