#31701 closed defect (fixed)

Bug in Polyhedron._richcmp_

Reported by: yzh Owned by:
Priority: major Milestone: sage-9.4
Component: geometry Keywords:
Cc: mkoeppe, gh-kliem, jipilab Merged in:
Authors: Yuan Zhou Reviewers: Jonathan Kliem
Report Upstream: N/A Work issues:
Branch: e04d37b (Commits, GitHub, GitLab) Commit: e04d37bd956399e067afa679a11057db6fbc503a
Dependencies: Stopgaps:

Status badges

Description

This method compares self and other. If they are both polyhedra, then <= means "is contained in", and < means "is strictly contained in".

Bug example:

sage: p1 = Polyhedron(vertices=[(1, 1), (0, 0), (1, 2)])
sage: p2 = Polyhedron(vertices=[(1, 2), (0, 0), (0, 2)])
sage: p2 < p1
False
sage: p1 > p2
True

It seems that the bug comes from line 707 of sage/geometry/polyhedron/base.py, where the code forgets one of the four cases.

Change History (8)

comment:1 Changed 14 months ago by yzh

  • Branch set to u/yzh/bug_in_polyhedron__richcmp_

comment:2 Changed 14 months ago by yzh

  • Commit set to e04d37bd956399e067afa679a11057db6fbc503a
  • Status changed from new to needs_review

New commits:

e04d37bfix bug in Polyhedron_base._richcmp_

comment:3 Changed 14 months ago by yzh

  • Cc gh-kliem jipilab added

comment:4 follow-up: Changed 14 months ago by gh-kliem

  • Reviewers set to Jonathan Kliem

Looks plausible.

Missing a green bot and author name.

Otherwise this is a positive review.

comment:5 in reply to: ↑ 4 Changed 14 months ago by yzh

Replying to gh-kliem:

Looks plausible.

Missing a green bot and author name.

Otherwise this is a positive review.

Thank you for the quick response!

comment:6 Changed 14 months ago by yzh

  • Authors set to Yuan Zhou

comment:7 Changed 14 months ago by mkoeppe

  • Status changed from needs_review to positive_review

comment:8 Changed 12 months ago by vbraun

  • Branch changed from u/yzh/bug_in_polyhedron__richcmp_ to e04d37bd956399e067afa679a11057db6fbc503a
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.