Skip to content

Bug in h_star_vector for polytopes with the normaliz backend #33847

@yuan-zhou

Description

@yuan-zhou

Dr. Ben Braun reported the following error.

The h-star-vector records the coefficients of the polynomial in the
numerator of the Ehrhart series of a lattice polytope.
The method h_star_vector() for polytopes with the normaliz backend was implemented in #28413.
The implementation seems to have an error, namely that it drops internal zeros from the vector.

Example:

sage: L = [[1, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0], [1, 0, 0,
....:  1, 0, 0], [1, 0, 0, 0, 1, 0], [1, 0, 0, 1, 2, 3]]
sage: P = Polyhedron(vertices=L,backend='normaliz')
sage: P.ehrhart_series().numerator()
2*t^2 + 1
sage: P.h_star_vector()
[1, 2]

Actually, the correct return should be [1, 0, 2].

This bug is caused by the line 1437 of src/sage/geometry/polyhedron/backend_normaliz.py, which forgets to pass sparse=False into self.ehrhart_series().numerator().coefficients().

We fix the bug by changing this line to
return self.ehrhart_series().numerator().list().

CC: @braunmath @sophiasage @jplab @fchapoton @w-bruns @videlec @mkoeppe

Component: geometry

Keywords: polytopes, normaliz

Author: Yuan Zhou

Branch/Commit: 6027fb1

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/33847

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions