Skip to content
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

Take-2 of polar-decomposition #1050

Merged
merged 9 commits into from Dec 31, 2021

Conversation

metric-space
Copy link
Contributor

@metric-space metric-space commented Dec 22, 2021

Code inspired by this PR/thread: #656

Main person behind this is @LucasCampos

This PR implements matrix polar decomposition

metric-space added 2 commits December 22, 2021 00:12
Code inspired by this thread: dimforge#656
Main person behind this is LucasCampos
Add one more test for decomposition of polar decomposition of rectangular matrix
@metric-space metric-space marked this pull request as ready for review December 27, 2021 02:02
@sebcrozet
Copy link
Member

Thanks! I took the liberty of making a few small changes:

  • I renamed Matrix::polar to Matrix::try_polar and added Matrix::polar which returns the result instead of Option (similar to the other methods, e.g., Matrix::svd and Matrix::try_svd).
  • I made your test use proptest instead of DMatrix::new_random. This will cover more cases.

The new proptest test is failing right now. I haven’t investigated in details yet to determine if this is a bug, or if the test are just failing because we used an epsilon that is too restrictive.

@metric-space
Copy link
Contributor Author

metric-space commented Dec 31, 2021

@sebcrozet Thank you for the review and the additions. Not sure if you plan to look into it further but I will take look into the bug with the prop test and return back with a fix/solution

@metric-space
Copy link
Contributor Author

metric-space commented Dec 31, 2021

I zeroed in on the causes.

  1. The orthogonal test is a proxy for a unitary/semi-unitary check. It's a unitary check for square matrices and supposed to be a semi-unitary check for rectangular matrices which is a bit more involved because it tests whether either the rows are orthogonal or the columns are orthogonal. It depends on the dimensions of the rectangular matrix

  2. In the main test, the test svd generated is ordered while the method based polar calls the unordered SVD for further processing, which gives different decompositions

Fixes applied and tests pass locally
Ball's back in your court @sebcrozet

@sebcrozet sebcrozet merged commit 99ac8c4 into dimforge:dev Dec 31, 2021
@sebcrozet
Copy link
Member

Perfect, thanks!

@metric-space
Copy link
Contributor Author

Thank you

@metric-space metric-space mentioned this pull request Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants