Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use power iteration and Dimensionality reduction for eigenvalues #340

Open
Beakerboy opened this issue Aug 23, 2019 · 4 comments
Open

Use power iteration and Dimensionality reduction for eigenvalues #340

Beakerboy opened this issue Aug 23, 2019 · 4 comments

Comments

@Beakerboy
Copy link
Contributor

Beakerboy commented Aug 23, 2019

I think I figured out the general technique for simultaneously finding eigenvalues and eigenvectors for any matrix...numerically.

use power iteration to find largest...this gives both the value and the vector, then subtract it from the source matrix and repeat.

$eigenvalues = [];
$vectors = [];
for ($i = 0l $i < $A->getM(); $i++) {
    list ($eigenvalue, $eigenvector) = Eigen::powerIteration($A);
    $eigenvalues[] = $eigenvalue;
    $vector = MatrixFactory::columnMatrix($eigenvector);
    $vectors[] = $eigenvector; // Adding as a new row
    $A = $A->subtract($vector->multiply($vector->transpose())->scalarMultiply($value));
}
$eigenvectors = MatrixFactory::create($vectors)->transpose();
@markrogoyski
Copy link
Owner

Is there a use case for this that differs from existing methods? Like it is better for large matrices vs Jacobi, for instance?

@Beakerboy
Copy link
Contributor Author

The Jacobi method only works on symmetric matrixes.

@markrogoyski
Copy link
Owner

Would implementing this solve issue #346 where power Iteration finds an eigenvalue that is not necessarily the dominant one because of the selection of the random starting vector? Basically, could you use this process to find all the eigenvalues, and then just figure out what the dominant one is and return that for the powerIteration method?

@Beakerboy
Copy link
Contributor Author

Beakerboy commented Oct 7, 2019

That’s a good idea. Instead of finding just the “largest”, find a few and then grab the largest of those. Alternatively, I wonder if, after a solution is found, the solution eigenvector could be perturbed slightly and used as a new starting point to ensure that it converges on the same eigenvalue, and not one that is larger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants