Skip to main content

Exact, order-invariant, bit-identical floating-point reductions and CRDTs (Rust core).

Project description

bitrep (Python)

Exact, order-invariant, bit-identical floating-point reductions and CRDTs — a thin Python binding over the Rust bitrep engine, so every result is the same across any machine, any merge order, any sharding.

pip install bitrep
import bitrep

# Exact sum — naive float gives 0.0; this gives 1.0, and it's order-invariant.
s = bitrep.SumF64()
for x in (1e16, 1.0, -1e16):
    s.add(x)
print(s.value())            # 1.0

# Exactly-rounded statistics
m = bitrep.MomentsF64()
for x in (2, 4, 4, 4, 5, 5, 7, 9):
    m.add(x)
print(m.mean(), m.variance())   # 5.0 4.0

# Receipt: same multiset -> same 32-byte hash, regardless of order.
print(s.state_hash().hex())

# CRDT map that converges without a coordinator
a = bitrep.SumMap(); a.add("k", 1.5); a.add("k", 2.5)
b = bitrep.SumMap(); b.add("k", 2.5); b.add("k", 1.5)
a.merge(b)                   # idempotent, order-invariant

What's included

Exact accumulators (SumF64, SumF32, FastSumF64), exact dot product (DotF64, dot), convergent statistics (MomentsF64, Moments4F64 with skewness/kurtosis, CovF64 regression, WeightedMomentsF64, PnMomentsF64 retractable, CovMatrixF64 multiple regression), HistogramF64 (exact counts + honest quantile bounds), ExtremaF64, signed receipts (state_hash), and the CRDT layer (SumMap, MomentsMap, ReplicatedSum, DeltasSum).

The convergence laws of the core are machine-checked in Lean 4. See the main repository for proofs, the Rust crate, and the paper.

License: MIT OR Apache-2.0.

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

bitrep-0.2.1.tar.gz (111.6 kB view details)

Uploaded Source

Built Distributions

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

bitrep-0.2.1-cp38-abi3-win_amd64.whl (269.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

bitrep-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (409.6 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

bitrep-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (405.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

bitrep-0.2.1-cp38-abi3-macosx_11_0_arm64.whl (366.0 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

bitrep-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl (372.9 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file bitrep-0.2.1.tar.gz.

File metadata

  • Download URL: bitrep-0.2.1.tar.gz
  • Upload date:
  • Size: 111.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for bitrep-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e749f6c4f6be69d90a74facbbb80cd59417f378f38879303c586e1033245ae3f
MD5 da8af400c257ad962a7ba39bbbc2723e
BLAKE2b-256 8778057d2c5d06de85a60c8b5ac2c1b03fd952d5a51c2cec284e1d694e0691c5

See more details on using hashes here.

File details

Details for the file bitrep-0.2.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: bitrep-0.2.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 269.2 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for bitrep-0.2.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 86af0c8aef6836770501d58b58b94f880333c8a4d5e1cd66364910b2e9563819
MD5 8c8ffc4d079618144a6965854e4d7a2b
BLAKE2b-256 6767548dc788c91272ef78fda10cb7d620e4fa8784983b3f1c3358bad51cee86

See more details on using hashes here.

File details

Details for the file bitrep-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for bitrep-0.2.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d7a9f424cdf4c83e4e8366bcd99e3a44755fd966f773abb62797e97d9f1724ac
MD5 46cb38d6e2a2f04e9f0887dc0cef4a7b
BLAKE2b-256 f5d1f66046dd283162987e15a97ef9f4b5ba793365751195a37673ad8e1520eb

See more details on using hashes here.

File details

Details for the file bitrep-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for bitrep-0.2.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6b99320f35e70dbbf0d91d85887d8412770293d8bab0dd375e8d06dbfad846a4
MD5 d64cc964b058e11aacc8e06d1c51e082
BLAKE2b-256 419967c1fec0fffa51ac25728b261351f43f15f640b09160d802216d3a632212

See more details on using hashes here.

File details

Details for the file bitrep-0.2.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bitrep-0.2.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f17050e0fbe73f65aa730f0bde9e215c9a6c1e5857ecf5878c285978969118e
MD5 79f0f7d251befa902f5e4c54a7402c50
BLAKE2b-256 e91114acec5d24fa948b69cc953673b444c0dd1bb8c24d83deb57a1733b91ff2

See more details on using hashes here.

File details

Details for the file bitrep-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bitrep-0.2.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e0d1b8f94ed174c9c6362e9c36abf5a01711f83882d4f42c3089221cc7ce7c95
MD5 b1186ae833685063aa7a7bcd664d0d2f
BLAKE2b-256 024868e9effc379c21b487264e2d927d4e96078ecde0d95e86179ad61eac8251

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