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

corrected the purity and convexity for polyhedral #39777

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

khadar1020
Copy link

@khadar1020 khadar1020 commented Mar 24, 2025

Solving Polyhedral issue with out giving any Division by Zero Error
Fixes: #39689
changes made
changed is_convex method to handle empty complexes and avoid ZeroDivisionError by adding an early check for empty vertices.
I have also added a check for self.dimension() == -1 in is_convex to handle empty complexes.

Thank you

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@DaveWitteMorris
Copy link
Member

You need to add a doctest for each of the errors that you fixed. These should also test all of the code paths that you added.

The following code calls self.dimension() twice. It would be better to move the if statement after the definition of d, so you can used instead asking for the dimension again.

        if self.dimension() == -1:
            self._is_convex = True
            return True
        d = self.dimension()

This code also does not set self._polyhedron, even though the complex is convex. Won't other code expect there to be a polyhedron? Will this cause errors?

@khadar1020
Copy link
Author

khadar1020 commented Mar 27, 2025

I have made the changes @DaveWitteMorris regarding self._polyhedron it will not cause any error I have tested it all test cases passed but it safer to add initial I have added it

Thank you

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

Successfully merging this pull request may close these issues.

ZeroDivisionError in is_convex method of PolyhedralComplex
2 participants