{"id":24204,"library":"passagemath-cddlib","title":"passagemath-cddlib","description":"Python binding for cddlib, implementing double description method for convex polyhedra (V- and H-representation). Part of the passagemath ecosystem. Current version 10.8.4, requires Python >=3.11 <3.15. Release cadence is irregular, following the passagemath umbrella releases.","status":"active","version":"10.8.4","language":"python","source_language":"en","source_url":"https://github.com/passagemath/passagemath-cddlib","tags":["polyhedral computation","cddlib","convex analysis","linear programming","passagemath"],"install":[{"cmd":"pip install passagemath-cddlib","lang":"bash","label":"Standard install"}],"dependencies":[],"imports":[{"note":"cddlib is namespaced under passagemath. The top-level module 'cdd' is not available.","wrong":"import cdd","symbol":"cdd","correct":"from passagemath.cddlib import cdd"},{"note":"Explicit import path required.","wrong":null,"symbol":"Polyhedron","correct":"from passagemath.cddlib.cdd import Polyhedron"}],"quickstart":{"code":"from passagemath.cddlib import cdd\nimport os\n# Create a polytope from H-representation (inequalities)\n# Example: nonnegative orthant in 2D\nmat = [\n    [1.0, 0.0],  # 1*x >= 0? Actually line: 1*x + 0*y >= 0\n    [0.0, 1.0],  # 0*x + 1*y >= 0\n]\nlin = [1, 1]  # all inequalities are linear (not inequalities but equalities? use linearity)\n# Actually define inequalities: x >= 0, y >= 0\n# But cdd uses row major: each row is [b, -A]\n# For standard form Ax <= b, we need to convert.\n# Let's use a simpler example: simplex\n# Represent the triangle with vertices (0,0), (1,0), (0,1) in V-rep\nV = cdd.matrix_from_array([\n    [0, 0, 1],  # (0,0) with 1 for inhomogeneous\n    [1, 0, 1],\n    [0, 1, 1]\n])\nV.rep_type = cdd.RepType.GENERATOR\npoly = cdd.Polyhedron(V)\n# Check H-representation\nH = poly.get_inequalities()\nprint('H-representation:')\nprint(H.array)","lang":"python","description":"Create a polyhedron from V-representation and print its H-representation. Uses the cddlib matrix convention."},"warnings":[{"fix":"Always consult the renorm module or carefully convert your inequalities to the cdd format. Use the matrix_from_array helper and manually set rep_type.","message":"The cddlib library uses a non-standard matrix format: each row is [b, -A] for inequality Ax + b >= 0. Use cdd.matrix_from_array() and set rep_type. For H-representation each row is [constant, -coefficients].","severity":"gotcha","affected_versions":"all"},{"fix":"Do not install both 'cdd' and 'passagemath-cddlib' in the same environment. Use only 'passagemath-cddlib' and import from 'passagemath.cddlib.cdd'.","message":"The passagemath ecosystem may conflict with the standalone 'cdd' package if installed. Both provide a 'cdd' module, but passagemath-cddlib uses a namespaced import.","severity":"gotcha","affected_versions":"all"},{"fix":"Uninstall 'cdd' and install 'passagemath-cddlib'. Change imports to 'from passagemath.cddlib import cdd'.","message":"Older versions (<10.0) used the package 'cdd' directly, but that package is now separate and unmaintained. Migrate to 'passagemath-cddlib' for updates.","severity":"deprecated","affected_versions":"<10.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from passagemath.cddlib import cdd","cause":"The import 'import cdd' is used instead of the correct namespaced import.","error":"ImportError: No module named 'cdd'"},{"fix":"Before creating Polyhedron, set mat.rep_type = cdd.RepType.GENERATOR (or INEQUALITY) correctly.","cause":"The matrix rep_type must be set explicitly before constructing Polyhedron, or the format is wrong.","error":"ValueError: invalid RepType. Use RepType.GENERATOR for V-representation, RepType.INEQUALITY for H-representation."},{"fix":"Ensure your matrix has at least as many rows as the ambient dimension (including constant column). For example, for 2D, at least 2 rows.","cause":"The input matrix has too few rows (inequalities) or the dimension is incorrect. The cdd library requires at least as many rows as dimension.","error":"passagemath.cddlib.cdd.LinIndepError: number of rows less than number of columns"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}