Jacobi eigenvalue algorithm #461

Merged
ivandev0 merged 5 commits from kylchik/jacobi into dev 2022-02-20 10:18:06 +03:00
ivandev0 commented 2022-02-17 12:28:07 +03:00 (Migrated from github.com)

Instead of using the SVD to compute the eigendecomposition of a real symmetric matrix, I implemented the Jacobi's method.

Tested correctness of algorithm with space.kscience.kmath.tensors.core.TestDoubleLinearOpsTensorAlgebra test. Not sure about performance, it require further investigation. Maybe it is worth to implement cyclic Jacobi algorithm.

Instead of using the SVD to compute the eigendecomposition of a real symmetric matrix, I implemented the Jacobi's method. Tested correctness of algorithm with `space.kscience.kmath.tensors.core.TestDoubleLinearOpsTensorAlgebra` test. Not sure about performance, it require further investigation. Maybe it is worth to implement cyclic Jacobi algorithm.
grinisrit commented 2022-02-17 19:55:00 +03:00 (Migrated from github.com)

@ivandev0 you might want to have a look at this implementation: https://github.com/mipt-npm-study/numerics-2021/blob/master/jacobi.cc , some notes are available in the notebook https://github.com/mipt-npm-study/numerics-2021/blob/master/seminar5.ipynb and I relied on the classcial algorithm from http://numerical.recipes/

@ivandev0 you might want to have a look at this implementation: https://github.com/mipt-npm-study/numerics-2021/blob/master/jacobi.cc , some notes are available in the notebook https://github.com/mipt-npm-study/numerics-2021/blob/master/seminar5.ipynb and I relied on the classcial algorithm from http://numerical.recipes/
CommanderTvis commented 2022-02-18 16:09:09 +03:00 (Migrated from github.com)

Changed the base to not affect master again.

Changed the base to not affect `master` again.
ivandev0 commented 2022-02-20 02:52:32 +03:00 (Migrated from github.com)

So, I fixed it. In my opinion It is harder to read current code, but it is 10x faster than SVD :)

Benchmark                                   Mode  Cnt    Score    Error  Units
TensorAlgebraBenchmark.tensorSymEigJacobi  thrpt    5  567.582 ± 37.343  ops/s
TensorAlgebraBenchmark.tensorSymEigSvd     thrpt    5   47.725 ±  3.372  ops/s
So, I fixed it. In my opinion It is harder to read current code, but it is 10x faster than SVD :) ``` Benchmark Mode Cnt Score Error Units TensorAlgebraBenchmark.tensorSymEigJacobi thrpt 5 567.582 ± 37.343 ops/s TensorAlgebraBenchmark.tensorSymEigSvd thrpt 5 47.725 ± 3.372 ops/s ```
ivandev0 commented 2022-02-20 02:58:16 +03:00 (Migrated from github.com)

This last commit is not about Jacobi algorithm but mostly an addition to my previous PR. I figured out that tensor and matrix are kind of the same type and dispatch to real dot depends on used algebra (please fix me if I am wrong). So I dropped duplicate test that I added.

This last commit is not about Jacobi algorithm but mostly an addition to my previous PR. I figured out that `tensor` and `matrix` are kind of the same type and dispatch to real `dot` depends on used algebra (please fix me if I am wrong). So I dropped duplicate test that I added.
grinisrit (Migrated from github.com) approved these changes 2022-02-20 09:28:59 +03:00
altavir (Migrated from github.com) approved these changes 2022-02-20 10:17:52 +03:00
Sign in to join this conversation.
No description provided.