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

feat: add new projection operators #34

Merged
merged 9 commits into from
Jan 26, 2021
Merged

feat: add new projection operators #34

merged 9 commits into from
Jan 26, 2021

Conversation

nperraud
Copy link
Collaborator

@nperraud nperraud commented Jan 22, 2021

New features

  • Adding proj_spsd : projection of a matrix on the symmetric positive semi definite cone
  • Adding proj_lineq: linear equality projection operator

@coveralls
Copy link

coveralls commented Jan 22, 2021

Coverage Status

Coverage increased (+0.06%) to 98.689% when pulling f809a01 on new-projections into b0eb893 on master.

@nperraud nperraud changed the title WIP: feat: add new projection operators feat: add new projection operators Jan 22, 2021
@nperraud nperraud requested a review from mdeff January 22, 2021 16:29
@nperraud
Copy link
Collaborator Author

A small PR with minimum modification and clean commits. The one we like the most.

I moved the paramter epsilon and method in proj_b2 instead of proj because proj_b2 is the only projection using them.

@@ -51,8 +51,10 @@ def assert_equivalent(param1, param2):
assert_equivalent({'y': 3.2}, {'y': lambda: 3.2})
assert_equivalent({'A': None}, {'A': np.identity(3)})
A = np.array([[-4, 2, 5], [1, 3, -7], [2, -1, 0]])
pinvA = np.linalg.pinv(A)
assert_equivalent({'A': A}, {'A': A, 'At': A.T})
Copy link
Collaborator Author

@nperraud nperraud Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I need to add the pinvA matrix because the proj_lineq cannot compute it A is given as an operator. The automatic computation only works if A is a numpy array.

@nperraud
Copy link
Collaborator Author

nperraud commented Jan 22, 2021

@mdeff PR ready to be reviewed.

@nperraud nperraud changed the title feat: add new projection operators 🚀 feat: add new projection operators Jan 22, 2021
@nperraud nperraud changed the title 🚀 feat: add new projection operators feat: add new projection operators Jan 22, 2021
pyunlocbox/functions.py Outdated Show resolved Hide resolved
pyunlocbox/functions.py Outdated Show resolved Hide resolved
pyunlocbox/functions.py Show resolved Hide resolved
@mdeff
Copy link
Collaborator

mdeff commented Jan 25, 2021

Thanks! Looks good to me apart from the small comments above. (I simplified the proj_lineq test.)

@nperraud
Copy link
Collaborator Author

@mdeff Can I merge?

@mdeff
Copy link
Collaborator

mdeff commented Jan 26, 2021

proj_lineq is a special case of proj_b2 for epsilon=0 right? When is it preferable to use one or the other? That would be nice to put in the docs.

@nperraud
Copy link
Collaborator Author

Yes, it can be seen as a special case. If epsilon=0, you should always use proj_lineq as the implementation of proj_b2 is not really made of the case epsilon=0.

@nperraud
Copy link
Collaborator Author

Where would you put the information? In the proj_b2 doc?

@mdeff
Copy link
Collaborator

mdeff commented Jan 26, 2021

Great! Yep, in the proj_b2 doc.

@mdeff
Copy link
Collaborator

mdeff commented Jan 26, 2021

Actually, a better way is to have

        See Also
        --------
        proj_lineq : use instead of ``epsilon=0``

in proj_b2 and

        See Also
        --------
        proj_b2 : general case

in proj_lineq (between Parameters and Notes). That way, they will be linked in the HTML docs. Feel free to tweak the text.

@mdeff
Copy link
Collaborator

mdeff commented Jan 26, 2021

All good. Thanks!

@mdeff mdeff merged commit be4b6a2 into master Jan 26, 2021
@mdeff mdeff deleted the new-projections branch January 26, 2021 21:15
@nperraud
Copy link
Collaborator Author

Thank you for the good and efficient review process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants