Comments (8)
Hey @dgrnbrg, thanks for this example! I'm actually reasonably close to rewriting the eigenvalue/eigenvector routines for rulinalg
, so this is a useful example to check against. I've been pretty busy with real life the last few weeks, but I hope I should have some more time to look at it again in not too long!
from rulinalg.
HI! I also face this problem. I plan to port this code: https://github.com/fiji/Jama/blob/master/src/main/java/Jama/EigenvalueDecomposition.java
into Rust tomorrow, because I have not found reliable eigen solver for rust which will work stably.
from rulinalg.
@stiv-yakovenko: thanks for your interest, and your willingness to attempt a port!
I see now that it's been 3 months ago since I said that I would hopefully be able to look at it again soon. Unfortunately that didn't really hold up, so it's good if someone wants to take a look at it.
I took a brief look at the Jama implementation (not the details at this point). I don't agree with their overall API design, though I'm sure their implementation might be very good. In particular, an "Eigenvalue Decomposition" only makes sense for symmetric matrices. For non-symmetic matrices, one rather talks about the "Real Schur Decomposition". The idea I had for the design of eigenvalue algorithms for rulinalg
is as follows:
- For general real (possibly non-symmetic) matrices, one can construct an instance of
RealSchurDecomposition
, which furthermore allows one to compute (complex) eigenvalues and (complex) eigenvectors (note that these are different from the Schur vectors) - For real, symmetric matrices, one can compute a
SymmetricEigenDecomposition
(possibly a shorter name...), which furthermore allows computation of (real) eigenvalues and eigenvectors.
For complex eigenvalues, we'd have to introduce "HermitianEigenvalueDecomposition" for hermitian matrices. I haven't given much thought to the general complex case yet.
It seems that Jama tries to detect whether the matrix is (exactly) symmetric, and then compute either the symmetric eigenvalue decomposition or the real schur decomposition. I think detecting exact symmetry is a fragile approach: indeed, due to roundoff errors a matrix that is supposed to be symmetric may well have very slightly different elements in the corresponding element in the transpose.
Of course, .eigenvalues()
would be a convenient function to access this functionality without explicitly constructing the decompositions.
I'm certainly open for a discussion on how an eigenvalue API could look like in Rulinalg!
from rulinalg.
HI! I've finished this dirty work of transpiling and debugging the code. And for simple real-valued assymetric matrix the code works correctly. I propose to do some more testing, it may fail in some other cases. Now you can improve the code (I am rust beginner) and orchestrate it the way you like:
https://gist.github.com/stiv-yakovenko/2c59c9588b615556f20d4a2537f6cd8d
from rulinalg.
Thank you for the effort, @stiv-yakovenko! Unfortunately I can't promise that I'll get to it anytime soon (though I hope so, but I'm currently spending my limited time on a different, but tangentially related effort at the moment). If I don't, perhaps someone else is willing to pick it up in the meantime though!
from rulinalg.
Hey @stiv-yakovenko and @Andlon: if it makes sense, I can provide code review & suggestions for the algorithm.
from rulinalg.
Well, for my own purposes the algorithm works good enough, I don't have time to integrate it into rulinalg. If, as far as I understand, this project has no funding, then sorry, I'll leave integration task for the community.
BTW: algorithm also finds imaginary parts of eigen numbers.
from rulinalg.
@stiv-yakovenko - thanks for sharing your code. This gives a good start point for somebody looking to integrate into rulinalg.
@dgrnbrg please feel free to take the lead on that work if you want to. I'm sure it will be quite tricky but I am happy to try and provide feedback along the way.
Unfortunately I am in the same boat as @Andlon . I have a lot of other things going on and no time to dedicate for any serious attention to rulinalg for now...
from rulinalg.
Related Issues (20)
- (feature?) More flexible inner products HOT 2
- Make `Matrix::from_fn` row-major
- Using assert_*_equal macros in all tests HOT 1
- SVD goes in an infinite loop for certain matrices HOT 2
- Matrix debug info is incorrect on docs homepage? HOT 2
- Computation of numerically stable matrix operations HOT 3
- Add serde support HOT 1
- Document that Cholesky only uses the lower triangular part HOT 1
- Variance and mean could be calculated in a better way HOT 1
- Adapt matrix factorizations from nalgebra? HOT 5
- SVD algorithm will segfault if matrix has 0 rows or 0 columns
- 'Matrix row counts not equal.' should give matrix dimensions
- Multidimensional tensors
- Hosted documentation out-of-date
- I want to help HOT 4
- Right-multiplication by permutation matrix is inconsistent with representation
- Matrix Operations on Complex Numbers
- API soundness issue in `raw_slice` and `raw_slice_mut` HOT 1
- [Question] Will sparse matrices be supported?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rulinalg.