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.Generator (default): input has shape (n, d) (vertex coordinates).
  • repr=howzat.Representation.Inequality: input has shape (m, d+1) (H-rep rows (b, a...)).

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.Generator) -> SolveResult Convenience function which uses the default backend (howzat-dd[purify[snap]]:f64[eps[1e-12]]).
  • howzat.solve_exact(input, repr=Representation.Generator) -> 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.Generator) -> SolveResult Runs the backend.
  • Backend.solve_exact(input, repr=Representation.Generator) -> 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: V-representation coefficients (row-major, shape (n, d+1))
  • inequalities: H-representation coefficients (row-major, shape (m, d+1))
  • fails: int backend-specific failure count (pipeline dependent)
  • fallbacks: int backend-specific fallback count (pipeline dependent)

For solve_exact(...), the 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.4.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.4-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.4-cp313-cp313-manylinux_2_34_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

howzat-0.3.4-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.4-cp312-cp312-manylinux_2_34_aarch64.whl (7.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 10.12+ x86-64

howzat-0.3.4-cp311-cp311-manylinux_2_34_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 10.12+ x86-64

howzat-0.3.4-cp310-cp310-manylinux_2_34_x86_64.whl (9.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

howzat-0.3.4-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.4.tar.gz.

File metadata

  • Download URL: howzat-0.3.4.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.4.tar.gz
Algorithm Hash digest
SHA256 867c664ffa918c2cd8385af86eb57dc9eff0d0bbdc94d0eaf3f7e344f7c455ff
MD5 984671b3f1e6d39faaf4e2ec754f8616
BLAKE2b-256 c9f4317571def13fe339e7defd3de7439460e1df6e365676572d1d1d0a3b21ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 56a5cd9de8ebb09deacb702bdeb76d1b0ceabaf9a9f50e4ceb8d725ebcc686c5
MD5 1d2e5cf81af38b48e1a1a72d9166bd4b
BLAKE2b-256 bc1b3f00db9efe9c5006fa6a04a3c4d121e75286e0bf7970b7c88110529e8988

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 95feb41ad31f0e8f7f5b7d25bc19a7cf298e8a4ff91d20e2e62ca03a76f64894
MD5 f08dbc75aa86afc48d541f9be9fa53d7
BLAKE2b-256 753c5a214b2631caecfa822c298cc4bfdf9982a9da633e4b10048dc02d64b671

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7fe38cd5630265de502ede3a253d134dc27f938662ad89999ce6dd46c7c98a06
MD5 23bb6a9a4f05f31b0f484427c2338f44
BLAKE2b-256 4f911c5f1ca2542bf173297e7bddf7f67b7836dd35b34c1590f19145d5f4fae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ac0fce7562693add2bc6a1046acc6cee1d698693d3dc307162e39f39c0bfd825
MD5 37c074b404828118ff32abb417a8d6ee
BLAKE2b-256 389c595b760cd63d3a716726a7283b4b3b9324b25c6a4cd56e9f041dd2c8887a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 c33063d8ec4a1a6d9167536f4a9b0a205f2f94f433a273ccdfb39bced85b3edc
MD5 f991bec81c2d887cbcf88d7de23c054a
BLAKE2b-256 c743eb692ca1ab9050a17bf023cf7f40ae996502f132f2e2ddab55d82b07e261

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 db986e304848b6025227ba93866880ca67edeef39de141217cfcf5bb74e2ccc2
MD5 e9006c99da12af3669d31765dc6bc928
BLAKE2b-256 effe3ff12886da87ae7b3414b1c006113ff124c5ceb45cbc698809806e95517c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b9c0d60ee19ab3024e55de277aa8ab114a832afe2b10f81b890e451681fab208
MD5 a832c6aefd052dd63d91692ff94b9470
BLAKE2b-256 f92918177f86ead34ed10ad2417170ecde2dbdd8570466855d43c1fe3efc7ce3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f34616fbabf9964643a9543eda95e9168b3cdd52b1af4d2ac676b1605d10f1b4
MD5 de183d8499666e7c21035347c21e78bc
BLAKE2b-256 7dd6d30e34f1c4a8b4924c56188b0ec5288df1b66621d4289d94c9c84983e10b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 33a147e6ea881181d2ff494a88a026f2b1c8257e21926ddd7607cc3a0b3b92e5
MD5 b831d9adafb783fd69d23922ac46721b
BLAKE2b-256 18fba1cd8bd70d28e9808cebd9da15f86ccd686c6dbc1f050e62fb72260ae013

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp311-cp311-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 53560967320a44c5ff51dd6defa9f424ed415fc11f864b5405f3bab452c2f9b2
MD5 0a87250c26ba7b001f17654e2c0f2229
BLAKE2b-256 e466ce4b6955c0292396b00776decdac75c2d4d8b7ac8448d2c172f4a986df15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b3cc71a44268cda9d3dc02eb13cdc632379289f25feeca9bec5c0f372d6a8b3
MD5 4ba0255f815a53b7cd256ff4f67a1ac9
BLAKE2b-256 3de5580ab99251706bf2ad7e87af21b1a70cd4cf8195dea8e107123d9c614e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3ece9a7d44353158235353a4431be3c6e14f864ff6874c17206531f1c60c9553
MD5 86257f1ff6638595efb646451f3e58f2
BLAKE2b-256 8e64d84eaa182726f7dab5d02c2731f1aad6d843eefe6ef422f9cf3661fb7904

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7ea7899402fc48237c39763375385ece14f14dc0825dece88a023eb34973fded
MD5 ce12b530989082d0f50a17dae84221b6
BLAKE2b-256 20963eb6e68853ebb06f74dd41810caf61104e304453a4c595afd8c792afe7fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp310-cp310-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9ab75571143d746611b62ebe8bb532a5e05e3a8b5612c171f7d4ffd158f9f225
MD5 1d0bd07220224cf252389f6c4ba4331f
BLAKE2b-256 56ce875c4d5e5e476ea2c9014d9c33c9121eb6235ea1f48c68d9d4c37d22800c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a35d48f902232657a39c98430b0c1ebb82b69f98026b6d09d9c1f2d63fed5a2d
MD5 f4525908aebf32004d154b93d89b76a0
BLAKE2b-256 e2f0a648cbdf67ec6a68166d17e5a4d66c1890137d4beaead6a88e4986597641

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for howzat-0.3.4-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d8d7d2c1f4fe91af9c1e71e1686194e1ec3fa1260ac180322dd5a2d779be10a6
MD5 57e4fe5f55410b512797df4541d978b3
BLAKE2b-256 847720ab04f889b87178963e28ff5d77d1d2af89d82f3a5634fe5d1dec3a33d2

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