Skip to main content

High-performance polytope backends via Rust FFI bindings to howzat

Project description

howzat

User-friendly Python bindings for the Rust crates howzat and howzat-kit via PyO3.

Usage

import numpy as np
import howzat

verts = np.asarray([[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]], dtype=np.float64)

res = howzat.solve(verts)  # cached default backend: "howzat-dd[purify[snap]]:f64[eps[1e-12]]"
# res = howzat.Backend().solve(verts)  # same as above
# res = howzat.Backend("howzat-dd[purify[snap],adj[sparse]]:f64").solve(verts)  # force sparse adjacency graphs

verts_i64 = np.asarray([[0, 0], [1, 0], [0, 1]], dtype=np.int64)
res_exact = howzat.solve_exact(verts_i64)  # cached exact backend: "howzat-dd:gmprat"

print(res.facets, res.ridges)
print(res.facet_adjacency)
print(res.generators)    # numpy.ndarray[float64] (row-major, shape=(n, d+1))
print(res.inequalities)  # numpy.ndarray[float64] (row-major, shape=(m, d+1))

input must be a contiguous (C-order) 2D numpy.ndarray.

  • repr=howzat.Representation.EuclideanVertices (default): input has shape (n, d) (vertex coordinates).
  • repr=howzat.Representation.HomogeneousGenerators: input has shape (n, d+1) (homogeneous generator rows).
  • repr=howzat.Representation.Inequality: input has shape (m, d+1) (H-rep rows (b, a...)).

howzat.solve(...) accepts float64 arrays. howzat.solve_exact(...) accepts int64 arrays or dtype=object arrays containing exact rationals (e.g. fractions.Fraction objects).

Backends

The class howzat.Backend(spec) accepts backend spec strings, which specify the algorithm and parameters of the computation pipeline.

At a high level, the syntax is: KIND[OPTIONS][:SPEC]. Some examples:

  • howzat-dd[purify[snap]]:f64[eps[1e-12]] (default)
  • howzat-dd:f64
  • howzat-dd:f64[eps[1e-12],max]-resolve[gmprat]
  • cddlib:gmprational
  • cddlib+hlbl:f64
  • lrslib+hlbl (defaults to lrslib+hlbl:gmpint)

Backend options ([OPTIONS]) are comma-separated and may include:

  • adj[dense] / adj[sparse]: force dense bitset graphs vs adjacency lists (if supported natively)
  • purify[...]: configure howzat-dd purifiers, e.g. purify[snap] or purify[upsnap[gmprat]]

If adj[...] is omitted and the backend supports both adjacency representations, howzat-kit chooses dense unless the dense bitset representation would exceed 128MiB (for either the vertex graph, or the facet graph upper bound), in which case it chooses sparse.

Supported KIND[:SPEC] forms:

  • cddlib[:f64|gmpfloat|gmprational]
  • cddlib+hlbl[:f64|gmpfloat|gmprational]
  • howzat-dd[:PIPELINE]
  • howzat-lrs[:rug|dashu]
  • lrslib+hlbl[:gmpint]
  • ppl+hlbl[:gmpint]

API

  • howzat.solve(input, repr=Representation.EuclideanVertices) -> SolveResult Convenience function which uses the default backend (howzat-dd[purify[snap]]:f64[eps[1e-12]]).
  • howzat.solve_exact(input, repr=Representation.EuclideanVertices) -> SolveResult Convenience function which uses the default exact backend (howzat-dd:gmprat).
  • howzat.Backend(spec: str | None = None) Loads the specified backend; None selects the default.
  • Backend.solve(input, repr=Representation.EuclideanVertices) -> SolveResult Runs the backend.
  • Backend.solve_exact(input, repr=Representation.EuclideanVertices) -> SolveResult Runs the backend in exact mode (int64); errors if the backend is not exact.

SolveResult

A SolveResult has the fields:

  • spec: str backend spec actually used
  • dimension: int ambient dimension d
  • vertices: int number of vertices n
  • facets: int number of facets
  • ridges: int number of ridges (edges in the facet adjacency / FR graph)
  • total_seconds: float time spent inside the backend (seconds)
  • vertex_positions: list[list[float]] | None vertex coordinates if the backend returned baseline geometry
  • vertex_adjacency: DenseGraph | AdjacencyList vertex adjacency graph (dense or sparse)
  • facets_to_vertices: list[list[int]] for each facet, the incident vertex indices
  • facet_adjacency: DenseGraph | AdjacencyList facet adjacency graph (FR graph; dense or sparse)
  • generators: numpy.ndarray[float64] | list[list[str]] | None
  • inequalities: numpy.ndarray[float64] | list[list[str]] | None
  • fails: int backend-specific failure count (pipeline dependent)
  • fallbacks: int backend-specific fallback count (pipeline dependent)

For exact rational solves (solve_exact(...) with exact backend input), coefficient matrices are returned as list[list[str]] (exact strings).

Both graph types support:

  • node_count() -> int
  • degree(node: int) -> int
  • contains(node: int, neighbor: int) -> bool
  • neighbors(node: int) -> list[int]

Install

From PyPI:

python -m pip install howzat

Force a local source build, and enabling CPU-native codegen:

RUSTFLAGS="-C target-cpu=native" python -m pip install --no-binary howzat howzat

Prebuilt wheels are compiled for a portable baseline CPU (not target-cpu=native).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

howzat-0.3.7.tar.gz (17.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

howzat-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

howzat-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

howzat-0.3.7-cp313-cp313-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

howzat-0.3.7-cp313-cp313-macosx_10_12_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

howzat-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

howzat-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

howzat-0.3.7-cp312-cp312-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

howzat-0.3.7-cp312-cp312-macosx_10_12_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

howzat-0.3.7-cp311-cp311-manylinux_2_34_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

howzat-0.3.7-cp311-cp311-manylinux_2_34_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

howzat-0.3.7-cp311-cp311-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

howzat-0.3.7-cp311-cp311-macosx_10_12_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

howzat-0.3.7-cp310-cp310-manylinux_2_34_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

howzat-0.3.7-cp310-cp310-manylinux_2_34_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

howzat-0.3.7-cp310-cp310-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

howzat-0.3.7-cp310-cp310-macosx_10_12_x86_64.whl (8.3 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file howzat-0.3.7.tar.gz.

File metadata

  • Download URL: howzat-0.3.7.tar.gz
  • Upload date:
  • Size: 17.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for howzat-0.3.7.tar.gz
Algorithm Hash digest
SHA256 7ad304f97b4588c10bb86dc13e4549bb12d112b5fadbc3a22da62cc80db962eb
MD5 6cdbcbab0b67021644d2b2de0d14448e
BLAKE2b-256 ae6014989be2ba356c1c83188fc576dc56367fcb092beed060a8435fa01d3daf

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7e1725bc7c23f365ebead19eaacdd214fe01f4d12d8316da8c3013e9163e12ed
MD5 710b60b61c9b815593316b02ed7dd662
BLAKE2b-256 0356e0986fb6a903675f030be87ac7bd7ec39806e625fc843fbf6e8c4672b7ee

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 8ee402e8753b98f0a57ad2bbaada0f6888824a691050efe560f6cf30e26f6f39
MD5 acdd5a217e22880be32c677dfb3d48c3
BLAKE2b-256 804af7cb7238b23fbd3fd91f6032bf32894e5d3dee1a5d08be5e79ba3a039322

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d71789d0faa8fbd5828ace389dcef702c5f15bd040cf4604ce4882f1792dab02
MD5 34e9bf31779267b5e95db0c0a12ec21c
BLAKE2b-256 25006ddf506676975dd8320d2ad356f72558a5d946bfe0122cbdd635e4ecd7e5

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4da1dd18e45410801c1497d036d5cc0149d9b2689490699d36d2ccfe1b0c958d
MD5 eb4971306008f20af0c5d4fe70af163b
BLAKE2b-256 9b91ba238abf99d9f7db456bf1fe2492f0c77d88a656c5092729753aa6ccb30a

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4b78e4f7d5f00ede96944cbace50505b46ab218d056d5749c4b1121c83a25c1c
MD5 e0614a962bae714b4bb5ad29d056a18f
BLAKE2b-256 79008c7bd453913ceb11a0ee95de489c6989e96f94a225818a89604093d06d37

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3619b54407ef781fe3da28fd2ef4f22e10fa6892aeb65cade85ec3b4ba6cf41f
MD5 a6bee9d6087caa86d8ac9478c6119649
BLAKE2b-256 1c0370b71db1fd032f04fc209a36a7f3c067053ff9fe3f983a4b56b0d780a1ff

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 853991ea89de9046991aa8135bbb9678d2b8e468daef1f6c59b0ddfe5365c494
MD5 93adf39503af9328d2592360aecd8320
BLAKE2b-256 8feb6da02d68c1abad84310088b781fa1d822ca72e2432b423ddea24abe6cb5d

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bfba5d976093045f6f4888073a945f616fdccb12f7ac583584785e7f775d0e39
MD5 f536e666f5d3ea3b35390de45ae0761c
BLAKE2b-256 17cbe9466c64c09bee795064d299228b84b5c2416540d9302e0a0ac99f4df180

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fdcab5eab634eb6e67e66e119fb437165a8aa6d17dcda8f0bd23a67605ccf9cb
MD5 445666fd74c1cf69b1ce60c2482576e3
BLAKE2b-256 1b098ab138c4a95342a0c08dbcd4f7d02db104d5a7e420cba2b62046fd2d6112

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp311-cp311-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 6d86bf78864bd80015adeb72a7338ed99bc6e02b912f9630fcac71201ca0fee6
MD5 e8c6b275ec2fbe0ef9ec31a2b3d321ee
BLAKE2b-256 33b27da31d64781b104e2b010f472882c219d3be7bbe89c62f39b97f2920306f

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 821ef857546be035fd80f1f614c95fd521d946fa864467c3b5a245f89f8edbac
MD5 8038d0d965fa8dc3211922ba842e3324
BLAKE2b-256 5774240a7568c2496e93ea42ee275d4cede94a5f905799efe4d7b0350b38c975

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4dddbde4088f38f909c67ab99dfb1d22151967cd6730882addf63278c9f57466
MD5 736ffbe2ebe8d10f84a7a24b75f8e8d7
BLAKE2b-256 b870ab902804001d6300bebe44de92832e7bd0bcab6c659acb054d1837faf01e

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 41225e4abcb9c5a66c37948b5981c4e746dda3d3f03442bd3e422fd4344db2b9
MD5 f6f971b6866125e3289871640ab0ee5a
BLAKE2b-256 fba67f6b36ec63e8c1e92a225c295304ab4841ee6f3ad8ccc6f8e495d89ca524

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp310-cp310-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9e2b4b76f46cd5c02c86f66132728fcc88e7ac2a25855d4169b2f8d1a0354525
MD5 16d325c15cfb0ba40d1555f7dec3d015
BLAKE2b-256 7c9121d9d0b6fb94704dde94389ee45e30b154f1cdd3d6b654db94027c925495

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e1a6ee8971df9306af751fcbb8e598a0f6ec67d63365c392e6cf9a5cb6dbad6
MD5 ad86ea6084f52d6b9de1ffd294008e79
BLAKE2b-256 c271e14e073eb91abd351f8a05babb8672ae9eb8dab8aa3d1fe6ec06f81a5dd3

See more details on using hashes here.

File details

Details for the file howzat-0.3.7-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for howzat-0.3.7-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 43284f27cd7d91429d60f799aa91cd7db35295153381ea8b9bf0fbe147ebbfff
MD5 e5c678ef558e5e937f8208d66fd82761
BLAKE2b-256 7c6fd4a59203d90a3f7513a05d19afb35aafb3c507f1f35b566b06e6eba60265

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page