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
Polar decomposition #656
Polar decomposition #656
Conversation
Hi, thank you for this PR! The problem here is that you are trying to multiply a matrix with elements of type |
This seems to have fixed the problem! Now I will write the serialize/deserialize code, some tests + benchmarks and ask for a new review. |
Just a small update. This pull request seems relatively ready for the beta version, but some things are still missing. Below I summarize what we have, what we need, and where I think we should go in the near future. What is already implemented
Missing for the beta version are
What I think we should aim for in the final version
|
The first alpha version seems to be ready. We have it working properly for This might be a good moment for a general code review. There are some things I would like to discuss about as well, as they are on the API/user experience level. Those copy and expand on the last comment. Slightly change the interface of polar to allow fine-grained control of the construction of left/right Hermitian matricesThe way I envision this is to copy the interface of the I also can see the point of having another interface to create the polar decomposition, which accepts an pre-computed SVD. This one I am a bit less sure how useful will be. Write more comprehensive set of tests for square matricesIf the input matrix is square, there are more tests we can do regarding the properties of each component in the decomposition. Namely, that the rotation matrices are indeed unitary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @LucasCampos for the very late answer. I've been sick on and off during the past two weeks. I'm all OK now.
Thank you for the work you have done so far!
The way I envision this is to copy the interface of the SVD module.
That sounds like a good idea. If the interface is the same as for the SVD, I don't think this will be too much of a cognitive load.
Alright, so this is a difficult part. Before you begin, I suggest:
Next, there are two steps: determine the trait bounds required by the Trait bounds for
|
3628f12
to
fb69a42
Compare
Hello. I want to get back working on this project now that I have a little bit more free time. It seems that in the really long interval since my last commit something changed on how one builds and runs the tests in When running cargo as cargo test The tests compile and run without any issues. However, when using cargo test --feature arbitrary compilation fails, as seen in the error log below. Are there any workarounds for this issue, or are the I have tried both Cargo/rustc 1.44.1 and nighty.
|
700c4dc
to
c5c6c13
Compare
@LucasCampos @sebcrozet was wondering if I can take on fixing this to get this merged if the original author (@LucasCampos ) has no time ? |
I would be thrilled if you did! Just be warned that the code is kinda old, and things might have changed in the base repo. |
I just took a brief look over the original PR. I'm a bit confused why there are three matrices in the decomposition. Usually the polar decomposition looks like
where Anyway, as @LucasCampos said, much has changed in |
One can perform the left or the right polar decomposition. I.e.,
Agreed. |
I've never seen the second variant before. All applications of polar decomposition I've ever seen uses the form |
I have only seen the other form being used in analytical proofs, never in numerics. For my originally intended use, the form I guess it makes sense to implement a single version for now and see if a concrete usage of other uses emerge in the future. For what it is worth, scipy implements both forms, so there might be some use I am not aware of. |
Thanks for the From my perspective, it would make sense to first just implement |
Completely agree. I guess the final call depends on @metric-space. |
Reading this PR again today, I’m wondering if there is any benefit in having a dedicated structure for the polar decomposition?
|
The design was based on that of |
Apologies for the radio silence
Makes sense and can and will do
This route seems the more sensible to me, but this might change given more time spent in the trench/ more thought. Logistics question: |
Update on this. Starting off a fresh branch. I'm fiddling around with bound traits and trying to figure out if it makes sense to bypass having to use DMatrix related ops in the original PR, but use OMatrix related ops |
Update on this: still working through, just a bit in wandering mode when it comes to understanding type-level ops and allocator stuff |
Code inspired by this thread: dimforge#656 Main person behind this is LucasCampos
As an explicit note to everyone involved in this thread: the cleaned up PR for this was put up and has been merged #1050 Thank you all. Hopefully we can close this PR |
Hello. As detailed in this thread in the user forum, I am implementing the matricial polar decomposition in nalgebra.
The bulk of the code is ready. However, I am having some issues with the traits needed to properly compile the code.
Cleanup and further implementations are still in the 'to do' list.
Any pointers on the specific type traits needed would be appreciated.
The compile errors are