cddlib-rs

Crates.iocddlib-rs
lib.rscddlib-rs
version0.1.0
created_at2026-01-13 14:46:22.938128+00
updated_at2026-01-13 14:46:22.938128+00
descriptionIdiomatic Rust bindings around cddlib.
homepage
repository
max_upload_size
id2040345
size113,394
Keeley Hoek (khoek)

documentation

README

cddlib-rs

Safe Rust bindings over cddlib-sys. Wraps cddlib's double-description routines for convex polyhedra without exposing raw pointers.

Features

  • Safe wrappers: Matrices, polyhedra, and LP solutions with RAII lifetime management.
  • Multiple backends: f64, CddFloat, CddRational---selectable via generics.
  • Familiar API: Compute facets, generators, and widths using standard Rust types.

Example

use cddlib_rs::{CddRational, Matrix, Polyhedron};

let verts = vec![vec![0.0, 0.0], vec![1.0, 0.0], vec![0.0, 1.0]];

// Inferred scalar type (`f64` here).
let poly = Polyhedron::from_vertex_rows(&verts)?;

// Convert to exact rationals.
let m_f64 = Matrix::from_vertex_rows(&verts)?;
let m_rat: Matrix<CddRational> = m_f64.convert()?;
let poly_exact = Polyhedron::from_generators_matrix(&m_rat)?;

let facets = poly_exact.facets()?;

All backends enabled by default. Matrix and Polyhedron default to f64.

License

AGPL-3.0-only. See LICENSE for details.

Commit count: 0

cargo fmt