-
Notifications
You must be signed in to change notification settings - Fork 131
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
Trouble Creating Custom SymShiftInvert operation that uses Eigen::UmfpackLU instead of Eigen::SparseLU #136
Comments
I've also confirmed separately that the UmfpackLU solver works as expected on the same system matrix I'm trying to solve. So it really is when I give it to my SymGEigsShiftSolver that it gets overwritten and doesn't behave as expected |
Now that I have more time I'll share some of my code:
Looking into the data pointed to by Next, we pass our ops into the
as soon as this line executes, all the data pointed to by our Specifically, doing so leads me to a For completeness, here is my custom UMFPACKSymShiftInvert class
I've played around with the format a bunch, such as storing my solver pointer on a heap, vs not. Making my solver a reference rather than a pointer to the solver defined outside... even creating and storing the solver entirely in the UMFPACKSymShiftInvert class (rather than a pointer). This same problem happens with anything I try. Is there any bandaid I can put on this that will let me use UMFPACKSLU? |
I did a little more investigating and came up with an inelegant bandaid fix.
It seems that the data stored in either operator's memory gets cleared after being passed through
I'll admit I'm not a C++ expert but I've noticed things like std::move that might clear some of the source data. My temporary fix is to simply re-initalize the relevant member variables in both my custom
And the code for my custom OpType UMFPACKSymShiftInvert
And finally my new custom MatProd (Which I'm surprised was also being overwritten..?)
So yeah! This was my bandaid fix to making UmfPackLU work for me with Spectra! I'm wondering if you know of a more elegant /permanent solution, or if you can shed any light as to what design choices are incompatible with each other! Maybe I shouldn't have spent so much time on it but I'm glad I did because my Eigen decompositions go wayy faster now ! |
Hi! I'm trying to solve a generalized eigenvalue problem on huge 100kx100k sparse matrices (that are not generally positive definite). I'm using the default shift invert solver. The SparseLU solver that SymShiftInvert uses seems to take forever.
To this end, it seems Matlab uses Umfpack and seeing as Eigen has a nice Wrapper for it, I wanted to see if it'd be as simple as replacing the SparseLU solver in my custom SymShiftInvert class.
Unfortunately it seems the GEigsSymShiftInvert solver uses move constructors that seem to destroy/overwrite crucial memory in the UmfpackLU solver. Specifically the mp_matrix member variable of the UmfpackLU solver becomes out of scope once we pass it to our generalized eigen solver, causing my programme to crash.
Is there a method you recommend using UmfpackLU instead of the default SparseLU for my SymShiftInvertOp? Could you shed some light as to why this overwriting is occurring?
Thank you
The text was updated successfully, but these errors were encountered: