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

Checks for is_separable are not complete #518

Closed
vprusso opened this issue Mar 24, 2024 · 7 comments
Closed

Checks for is_separable are not complete #518

vprusso opened this issue Mar 24, 2024 · 7 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@vprusso
Copy link
Owner

vprusso commented Mar 24, 2024

Several computational conditions are checked to determine if a state is separable presently in is_separable.py. However, several items are still not covered compared to the IsSeparable function from QETLAB.

This issue covers the additional separability checks from IsSeparable and includes test cases for each condition.

Note: At present, if all other separability checks are not hit, the failsafe is the final separability check imposed by invoking the symmetric extension hierarchy. This will eventually converge and will determine whether the state is separable (however this could be computationally intractable in general, and ideally, hitting as many of the prior cases first is ideal).

With that in mind, not all separability checks from QETLAB need to be ported over, but adding some more of them into toqito would be ideal. This issue could be considered closed then if a subset of the separability checks are ported over.

@vprusso vprusso added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Mar 24, 2024
@Yash-10
Copy link
Contributor

Yash-10 commented Jun 1, 2024

Hello, I have added a few conditions but it seems that testing those individually is challenging (especially as the condition lies below in the code) since the test cases tend to return a value (True/False) before reaching that point. One could curate the test cases to ensure it returns a value only for the condition to be tested, but I was wondering of some alternatives:

  1. Do you think it may be plausible to separate out each condition in a separate function? It may then be possible to test a specific condition in the tests. I understand some conditions are only conditionally checked, but perhaps the separate functions need not worry about that and could be handled in the driver code. Do you agree? If not, do you have any suggestions for generating curated test cases?
  2. I was thinking it might be better to print the reason for why a value is returned along with True/False, so that things are more transparent. This has been done in a few places but can be extended to all places.

@purva-thakre
Copy link
Collaborator

purva-thakre commented Jun 1, 2024

Hi @Yash-10 , thank you for your interest in working on this issue.

Indeed there are some test cases that have not been tested yet.

We have an open issue for increasing the test coverage #293. My last attempt to work on this was not that successful because the tests were not moving into a specific part of the code for certain use cases. Vincent's feedback on this was to temporarily add a print line to each rule in the hierarchy to check which code block was being used by is_separable for which unit test.

My plan for finding additional examples (test cases) was to go through the references listed in the docstring of the QETLAB function.

Let's wait for Vincent's feedback on the part where you want to break down the function into smaller functions. I think the comments in between the code are enough as is.

@Yash-10
Copy link
Contributor

Yash-10 commented Jun 1, 2024

Thank you, @purva-thakre, for your reply! Indeed, designing the test cases might take some effort. I have added references at (almost) all locations where output is returned in #612. Having added the conditions, I do tend to agree that the comments in the code might be good enough since there are many small, conditional checks in the code, and creating a function for each check may not be needed.

@vprusso
Copy link
Owner Author

vprusso commented Jun 2, 2024

Hi @Yash-10

Thanks for taking a stab at this one. And yes, I agree with @purva-thakre that keeping the checks in line is probably more sensible, as you rightfully point out, they should be small enough to not warrant separate functions.

Let us know if there are any additional questions, etc. you have, and thank you again for your contributions thus far!

@Yash-10
Copy link
Contributor

Yash-10 commented Jun 10, 2024

@vprusso and @purva-thakre thank you for merging the PR! Do you think the issue can be assigned now?

@purva-thakre
Copy link
Collaborator

Fixed by #612

@vprusso
Copy link
Owner Author

vprusso commented Jun 10, 2024

I believe @purva-thakre assigned you the issue. Let us know if there's anything else we missed, and thank you again for your contribution, @Yash-10 !

@purva-thakre purva-thakre added this to the v1.0.8 milestone Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants