#28370 closed defect (duplicate)

py3: polyhedron pynormaliz backend does not handle large coefficients correctly

Reported by: vdelecroix Owned by:
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: geometry Keywords:
Cc: mkoeppe, jipilab Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #28321 Stopgaps:

Status badges

Description (last modified by vdelecroix)

sage: x = polygen(ZZ)
sage: K.<sqrt2> = NumberField(x^2 - 2, embedding=AA(2).sqrt())
sage: P = Polyhedron(vertices=[(2**100, sqrt2), (sqrt2,1)], backend='normaliz')
Error in rational_handler: Python int too large to convert to C long
Error in nfelem_handler: unsupported operand type(s) for +=: 'NoneType' and 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
Error in rational_handler: Python int too large to convert to C unsigned long
Error in rational_handler: Python int too large to convert to C unsigned long
Error in nfelem_handler: unsupported operand type(s) for *: 'NoneType' and 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
Error in rational_handler: Python int too large to convert to C long
Error in rational_handler: Python int too large to convert to C long
Error in nfelem_handler: unsupported operand type(s) for *: 'NoneType' and 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
Error in rational_handler: Python int too large to convert to C long
Error in rational_handler: Python int too large to convert to C long
Error in nfelem_handler: unsupported operand type(s) for *: 'NoneType' and 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
sage: P.vertices()
(A vertex at (sqrt2, 1), A vertex at (0, sqrt2))

Even though PyNormaliz is perfectly fine working with large coefficients

sage: cone = PyNormaliz.NmzCone(cone=[],
....:          number_field=['a^2 - 2', 'a', '[1.414213562373095 +/- 2.99e-16]'],
....:          vertices=[[1267650600228229401496703205376r, [[0r, 1r], [1r, 1r]], 1r], [[[0r, 1r], [1r, 1r]], 1r, 1r]])
sage: PyNormaliz.NmzResult(cone, "VerticesOfPolyhedron")
[[[[0, 1], [1, 1]], [[1, 1], [0, 1]], [[1, 1], [0, 1]]],
 [[[1267650600228229401496703205376, 1], [0, 1]],
  [[0, 1], [1, 1]],
  [[1, 1], [0, 1]]]]
sage: PyNormaliz.NmzResult(cone, "SupportHyperplanes")
[[[[0, 1267650600228229401496703205376],
   [-1, 1267650600228229401496703205376]],
  [[1, 1], [0, 1]],
  [[0, 1], [0, 1]]],
 [[[0, 2], [1, 2]], [[-1, 1], [0, 1]], [[0, 1], [0, 1]]]]

Change History (9)

comment:1 Changed 20 months ago by vdelecroix

  • Description modified (diff)

comment:2 Changed 20 months ago by vdelecroix

  • Authors set to Vincent Delecroix
  • Dependencies set to #28321
  • Summary changed from Polyhedron pynormaliz backend does not handle large coefficients correctly to py3: polyhedron pynormaliz backend does not handle large coefficients correctly

I just think that #28321 is to blame (Python 3 issue)

comment:3 Changed 20 months ago by jipilab

You mean that it would be a duplicate? i.e. that the backend is fine?

comment:4 Changed 20 months ago by vdelecroix

It is probably not a problem with the backend.

comment:5 follow-up: Changed 20 months ago by vdelecroix

I confirm that it is solved with #28321... however, the fact that errors are not raised in the constructor is a bug in itself. In the example I wrote in the ticket description, I obtain a polytope P which is simply wrong. It is to my mind much better to get an error rather than false results.

comment:6 Changed 20 months ago by vdelecroix

  • Authors Vincent Delecroix deleted
  • Milestone changed from sage-8.9 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

comment:7 in reply to: ↑ 5 ; follow-up: Changed 20 months ago by jipilab

  • Status changed from needs_review to positive_review

Replying to vdelecroix:

I confirm that it is solved with #28321... however, the fact that errors are not raised in the constructor is a bug in itself. In the example I wrote in the ticket description, I obtain a polytope P which is simply wrong. It is to my mind much better to get an error rather than false results.

I agree. Where to raise this error? This should become another ticket?

comment:8 in reply to: ↑ 7 Changed 20 months ago by vdelecroix

Replying to jipilab:

Replying to vdelecroix:

I confirm that it is solved with #28321... however, the fact that errors are not raised in the constructor is a bug in itself. In the example I wrote in the ticket description, I obtain a polytope P which is simply wrong. It is to my mind much better to get an error rather than false results.

I agree. Where to raise this error? This should become another ticket?

  • Another ticket: yes
  • What to do: just remove the try/except
Last edited 20 months ago by vdelecroix (previous) (diff)

comment:9 Changed 20 months ago by chapoton

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.