Skip to main content

PQBlocks Sparse Bifurcation

quantum-inspired classical optimization — not cryptography, no security claim

High-performance sparse matrix Discrete Simulated Bifurcation (dSB) heuristic solver for large-scale Quadratic Unconstrained Binary Optimization (QUBO) and Ising problems.

Why

Dense Simulated Bifurcation solvers require $O(N^2)$ memory storage and $O(N^2)$ floating point operations per sweep. For large combinatorial optimization problems with thousands of variables and sparse connectivity (such as graph partition, network routing, and facility location), dense matrix formulations exhaust memory bandwidth and CPU cache limits.

pqblocks-sparse-bifurcation provides a compressed sparse row (CSR) Numba-compiled Discrete Simulated Bifurcation engine:

  • Scales to large instances ($N \ge 10,000$) with memory proportional to non-zero couplings $O(\text{nnz})$.
  • Achieves 2x to 25x execution speedup over dense bifurcation on sparse graphs.
  • Fully compatible with standard dimod BinaryQuadraticModel (BQM) interfaces.
  • Deterministic simulation receipts with SHA-256 state hashing for reproducibility.

Installation

Install using pip:

pip install pqblocks-sparse-bifurcation

Requirements: Python 3.11+, NumPy, SciPy, Numba, and Dimod.

Usage

Solve an Ising problem with sparse coupling matrix $J$ and linear field $h$:

import numpy as np
import scipy.sparse as sp
from pqblocks_sparse_bifurcation import SparseStructureAwareDSB

# Create sparse coupling matrix (CSR)
J = sp.csr_matrix([[0, 1, 0], [1, 0, 1], [0, 1, 0]])
h = np.array([0.0, 0.0, 0.0])

solver = SparseStructureAwareDSB(num_sweeps=1000, execution_mode="csr", seed=42)
sampleset = solver.sample_ising(h, J)

print("Best energy:", sampleset.first.energy)
print("Best sample:", sampleset.first.sample)

Solve a standard QUBO dictionary problem:

Q = {(0, 0): -1.0, (1, 1): -1.0, (0, 1): 2.0}
sampleset = solver.sample_qubo(Q)
print("QUBO solution:", sampleset.first.sample)

API reference

SparseStructureAwareDSB(num_sweeps=1000, dt=0.5, c0=None, execution_mode='auto', seed=None)

Main solver interface adhering to Dimod sampler conventions.

Parameters:

  • num_sweeps (int): Number of numerical symplectic Euler steps per read (default: 1000).
  • dt (float): Time integration step size (default: 0.5).
  • c0 (float, optional): Kerr non-linear scale coefficient; automatically derived from matrix norm when omitted.
  • execution_mode (str): One of 'auto', 'dense', 'csr', or 'locality_csr'.
  • seed (int, optional): Random seed initializing the SplitMix64 pseudo-random sequence.

Methods:

  • sample_ising(h, J, **kwargs) -> dimod.SampleSet: Solves the given Ising Hamiltonian.
  • sample_qubo(Q, **kwargs) -> dimod.SampleSet: Solves the given QUBO quadratic model.
  • solve_with_receipt(h, J, **kwargs) -> (dimod.SampleSet, RunReceipt): Returns solutions alongside a verifiable cryptographic run receipt.

Limitations

  • Heuristic Nature: Like all bifurcation solvers, dSB is a heuristic approximation algorithm and does not mathematically guarantee the global minimum on NP-hard instances.
  • CPU Cache Behavior: On small instances ($N < 500$), the memory footprint fits into L1 cache regardless of sparsity, where dense matrix vectorization may match CSR throughput.
  • Ising Diagonal: All input coupling matrices $J$ must have zero diagonal elements ($J_{ii} = 0$); non-zero diagonal couplings must be moved to the linear field $h$.

Security

This library implements classical numerical physics simulation algorithms. It contains no cryptographic keys, performs no encryption, and claims no cryptographic security properties.

Verification

Every release is verified using comprehensive automated test suites including:

  • Bit-identical agreement against reference continuous dynamical equations.
  • Formal property-based tests using Hypothesis for parameter scaling and numerical stability.
  • Golden vector verification against canonical Max-Cut problem instances.
  • Deterministic repeatability across identical seed configurations.

Part of PQBlocks

This package is part of the PQBlocks suite of post-quantum cryptography tools and quantum-inspired classical optimization heuristics. Visit https://github.com/PQBlocks for the full ecosystem of libraries.

Metadata

Release files for pqblocks-sparse-bifurcation 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pqblocks-sparse-bifurcation 0.1.0
File Size Uploaded Provenance Actions
pqblocks_sparse_bifurcation-0.1.0.tar.gz 31.6 kB Without provenance Details for pqblocks_sparse_bifurcation-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pqblocks-sparse-bifurcation 0.1.0
File Interpreter ABI Platform Actions
pqblocks_sparse_bifurcation-0.1.0-py3-none-any.whl Python 3 none any Details for pqblocks_sparse_bifurcation-0.1.0-py3-none-any.whl

Total release size: 48.5 kB

Release files / pqblocks_sparse_bifurcation-0.1.0.tar.gz

Download URL pqblocks_sparse_bifurcation-0.1.0.tar.gz
Size 31.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3a9c91d08a80b7a3a558d91d0a9d8b9b81d0e6d3221c0becab97dd520c1ba9ba
BLAKE2b-256 checksum
How to use checksums
539b6466c1a9e693fba9b888bb3599bebbf7e259a30ea5447038ee96312247d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Garuda Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pqblocks_sparse_bifurcation-0.1.0-py3-none-any.whl

Download URL pqblocks_sparse_bifurcation-0.1.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4c6b8da4acae15e0dd9f315b447fbc56ab96861f0085a793cfb64959739a9f7
BLAKE2b-256 checksum
How to use checksums
0ae0e1adfde246d01cdb1b50ead12cffb76034c04f80b319bc1fde5128f0634b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Garuda Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pqblocks-sparse-bifurcation 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page