-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Extend eigs
to a general matrix
#1741
Comments
eigens
to a general matrixeigs
to a general matrix
👍 |
I have been searching for a solution to a technical problem I have encountered. I want to calculate eigenvalues for a non-symmetric matrix. Any help would be appreciated as I am working on a web application that requires me to fund out the eigenvalue of a matrix whose size would go to 50x50. I was using power method to find the largest eigenvalue. But that fails if I have degenerate largest eigenvalue. Do you have any updates? |
Hey Atiya, EDIT: To get it working, this line needs to be updated to work with EDIT 2: Sorry, I misread that you only need eigenvalues. Than the code in my PR should be good to go, just modify it to skip the finding of eigenvectors. |
Cool. Thanks I will try fiddling around with it. For now I want the eigenvalues. I would require the eigenvectors as well but not as of yet. I will update here if I am able to get it working. Thanks |
@m93a Hey. So I was fiddling around the code and updated the comlex.js function to only return values and not find vectors. I compiled the build. And tried using it. I got an error in console that larger is not defined. Looking at the source, I can see a comment added Just wondering if It is worth jumping into. |
Hey Atiya, try replacing the whole function |
@atiyabzafar this can very well be caused by a merge conflict that still needs to be resolved. If that is so, it could be a matter of adding the function const dependencies = [ ... ] // add 'larger' to the array
export const createEigs = /* #__PURE__ */ factory(name, dependencies, ({ ... }) => { // add larger to the destructuring object
// ...
} For reference see this comment and the following few: #1743 (comment). |
Just wondering, how is this going? I'm developing a project that needs stuff like this (at the moment I think I can make do with |
@stur86 I am sorry for my late response. The algorithm is very near completion, see the PR for details. I also believe that my code is well-written and well documented, so you'll have a fine time reading it, if your comment is still current. |
Hey, replying to this as I haven't been able to solve eigenvalue for a simple matrix for some reason. As you can see above, I have been trying to get eigenvalues and vectors for general matrices. I saw that this was closed and merged in #1743. So I used the latest build, i.e. v9.4.1, and tried calculating the values for a simple matrix. I ran into a complication right away. Earlier I had written a code from scratch that was doing the same. I thought of getting rid of the bulk code from my app by using math.js. The above link would lead you to the example. It seems to me that eigs() is not able to calculate eigenvectors for complex eigenvalues. Is that the case? EDIT: I just checked #1743 , that @josdejong has mentioned the algorithm would still fail 50% of the time for the vector. My own implementation for QR failed miserably when i was working on it last year. And the project just halted. I would like to know what exactly is the issue here. |
Hey! 😁️ Since we don't have an iterative eigenvector finder yet, we search for eigenvectors using the equation (A − λE) v = 0. But sometimes the numeric error builds up, so that v is no longer a precise solution to that equation. This problem will be solved once somebody implements an iterative eigenvalue finder (see issue #2179). If you only needed the eigenvalues, the issue could be side-stepped by not computing the eigenvectors... if we had an API for that. Sadly, we still don't (see issue #2180). (On a completely unrelated note, you might find the If you really want to know the eigenvalues and can't wait for one of the two issues to be resolved, you can either use a different library, or use code like this: https://runkit.com/embed/qwm8i4qz5okm . This takes advantage of the fact that even if the algorithm fails, all the eigenvalues and eigenvectors that have been found so far will be passed as properties on the Error. EDIT: I've just merged #2237. Expect your code to work in the next minor version. |
Thanks for the reply @m93a I look forward to checking out the new merger (#2237 ) for sure. Perhaps I'll throw it matrices to test the new reverse iterative algorithms. I will update here once I have it in the next few days. |
As discussed in #1175, right now mathjs can only find eigenvalues of real symmetric matrices. It should also be able to find the eigenvalues and eigenvectors for general complex matrices. I'm consulting Numerical recipes in Fortran 77 when working on this issue.
The steps that need to be implemented in order to solve the eigenproblem are the following:
The text was updated successfully, but these errors were encountered: