-2

I can find eigenvectors of a matrix in Python as follows:

from numpy import linalg as LA
w, v = LA.eig(np.diag((1, 2, 3)))

But how to find the largest two eigenvectors for a larger matrix of size 100*200?

2

1 Answer 1

1

Eigenvalue decomposition is not defined for a non-square matrix. The closest operation is single value decomposition. SVD and EIG for a non-square matrix are related in that the single values are the square root of the eigenvalues of the transpose of the matrix times itself.

B = A' * A
SVD(A) * SVD(A) ~= EIG(B)

So one potential answer to your question is:

import numpy as np
A = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12]])
B = np.matmul(np.transpose(A), A)
u,s,v = np.linalg.svd(A)
V, D = np.linalg.eig(B)
print(f'Compare s*s to V {s*s - V}')

While s is not directly the eigenvalues of A it is somewhat related.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.