Skip to content

canonicalize segfaulting #35

@kylematoba

Description

@kylematoba

In the below, good functions run cleanly and prob functions signal 11: SIGSEGV. The same happens with for rational arithmetic. Python 3.7.4 on OSX, pip installed with GMP. pycddlib 2.1.0.

import numpy as np

import cdd


def prob1():
    h = np.array([[1, 0, 1],
                  [1, 1, 0]])

    h_eq = np.array([[1, .5, 0]])
    f_cdd = cdd.Matrix(h, number_type="float")
    f_cdd.rep_type = cdd.RepType.INEQUALITY
    p = cdd.Polyhedron(f_cdd)
    g = p.get_generators()
    g.canonicalize()

    f_cdd.extend(h_eq, True)

    p = cdd.Polyhedron(f_cdd)
    g = p.get_generators()
    g.canonicalize()


def good1():
    h = np.array([[1, 0, 1],
                  [1, 1, 0]])

    f_cdd = cdd.Matrix(h, number_type="float")
    f_cdd.rep_type = cdd.RepType.INEQUALITY
    p = cdd.Polyhedron(f_cdd)
    g = p.get_generators()
    g.canonicalize()

    p = cdd.Polyhedron(f_cdd)
    g = p.get_generators()
    g.canonicalize()


def prob2():
    v_one_side = np.array([[1, 1, 1],
                           [1, 0, 1],
                           [1, 1, 0]])
    v = np.vstack([v_one_side, -1 * v_one_side])
    f_cdd = cdd.Matrix(v, number_type="float")
    f_cdd.rep_type = cdd.RepType.GENERATOR

    p = cdd.Polyhedron(f_cdd)
    i = p.get_inequalities()
    i.canonicalize()


def good2():
    v_one_side = np.array([[1, 1, 1],
                           [1, 0, 1],
                           [1, 1, 0]])
    v = v_one_side
    f_cdd = cdd.Matrix(v, number_type="float")
    f_cdd.rep_type = cdd.RepType.GENERATOR

    p = cdd.Polyhedron(f_cdd)
    i = p.get_inequalities()
    i.canonicalize()


if __name__ == "__main__":
    # prob1()
    # prob2()
    good1()
    # good2()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions