Skip to main content

High-performance Causal Set matrix operations using memory-mapped files

Project description

PyCauset Logo PyCauset Text



Documentation PyPI version License: MIT

PyCauset is a high-performance Python library for Causal Set Theory.

PyCauset is NumPy for causal sets. Any programmer familiar with NumPy will automatically also know how to operate PyCauset. Like NumPy, PyCauset is backed by a strong C++ engine for efficient numerical linear algebra, while storage, hardware dispatch (CPU/GPU), and performance optimizations happen automatically behind the scenes.

PyCauset allows for handling of humongous matrices, as the module efficiently balances storage through both RAM and disk. The only limit to how large matrices you can work with is your disk storage. Example: with a 4TB external SSD, you can work with dense $N\times N$ float64 matrices of $N \sim 10^6$ (check this claim!).

Explore the Full Documentation »

Installation

From PyPI (Recommended)

pip install pycauset

We provide pre-compiled binary wheels for Windows, macOS, and Linux.

From Source

git clone https://github.com/BrorH/pycauset.git
cd pycauset
pip install .

Development Status and Roadmap

PyCauset is currently in pre-alpha. Here is the three-step roadmap plan for the future version 1.0:

  1. (WIP) High-performance C++ backed numerical linear algebra library. First focus is to build a robust, reliable and highly efficient linear algebra module that is designed with causal sets in mind. It is to behave like NumPy
  2. (PLANNED) Physics enginge and causal sets. With a robust linear algebra system in place, we will implement efficient methods for researchers to work with causal sets. Examples include: sprinkling methods, Pauli-Jordan eigenvalues, vev and propagator calculations, visualizations. Focus is on user experience and ease of use.
  3. (PLANNED) Documentation, guides, tests and benchmarks. Create an extensive suite of documentation and guides to help people use PyCauset and show its power and potential. Also perform extensive tests and squash bugs and perform benchmarks to illustrate proficiency.

Version 1.0 will feature the above and more.

Key Features

  • Hybrid Storage Architecture: PyCauset automatically manages memory. Small matrices live in RAM for speed, while massive datasets spill seamlessly to memory-mapped disk storage (single-file .pycauset containers).
  • GPU Acceleration: Built-in NVIDIA CUDA backend for matrix multiplication, inversion, and eigenvalue problems. Includes custom kernels for accelerated bit-matrix operations.
  • Smart Precision: Automatically selects Float64 or Float32 based on matrix size and hardware capabilities to maximize throughput.
  • Physics Engines:
    • Spacetimes: Minkowski Diamond, Cylinder, and Box manifolds.
    • Fields: Scalar field propagators ($K_R$) and path integrals.
  • Visualization: Interactive 3D visualization of embeddings and causal structures using Plotly.
  • Pausing Calculations: A long-winded and tedious calculation may be paused at any time and continued later. The calculation may also be exported and continued on another machine (WIP).

Quick Start

1. Simulating Spacetime

The CausalSet class is the main entry point for physics simulations.

import pycauset as pc
from pycauset.vis import plot_embedding

# 1. Sprinkle 5000 points into a 2D Minkowski Diamond
c = pc.CausalSet(n=5000, density=100, seed=42)

# 2. Access the Causal Matrix (TriangularBitMatrix)
# Stored efficiently (1 bit per element)
C = c.C

# 3. Visualize the embedding
fig = plot_embedding(c)
fig.show()

2. Quantum Field Theory

Compute the Retarded Propagator ($K_R$) for a scalar field.

from pycauset.field import ScalarField

# Define a massive scalar field (m=1.5) on the causal set
field = ScalarField(c, mass=1.5)

# Compute the propagator K = aC(I - b aC)^-1
# This uses GPU acceleration if available
K = field.propagator()

3. Pure Linear Algebra

You can use PyCauset as a high-performance sparse/dense matrix library.

# Create random causal matrices (10k x 10k)
A = pc.causal_matrix(10000, populate=True)
B = pc.causal_matrix(10000, populate=True)

# Fast GPU-accelerated BitMatrix multiplication
# Returns an IntegerMatrix of path counts
Paths = A @ B 

# Invert a dense float matrix
M = pc.zeros((2000, 2000), dtype=pc.float32)  # also accepts np.float32 or "float32" (case-insensitive)
M_inv = ~M # or M.inverse()

License information

PyCauset is published under the MIT license.

If you use PyCauset in your research, please cite: https://github.com/BrorH/pycauset

If you wish to contribute or have any questions, please contact me at bror[dot]hjemgaard[you can probably guess which symbol comes here]gmail(another dot)com

This repo contains AI-genetated code

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

pycauset-0.4.18.dev21.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

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

pycauset-0.4.18.dev21-cp311-cp311-manylinux_2_28_x86_64.whl (14.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

File details

Details for the file pycauset-0.4.18.dev21.tar.gz.

File metadata

  • Download URL: pycauset-0.4.18.dev21.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pycauset-0.4.18.dev21.tar.gz
Algorithm Hash digest
SHA256 1b7d1eee743a52544d83141d8aa52dd871f41c63ed6549d917ba8a22346dac96
MD5 763e04edaa6325a85477fc665b5dc531
BLAKE2b-256 993f26dde095c2ee06d5e6dfa0172be0a271cb734e7413a4eec8854c81c5063a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycauset-0.4.18.dev21.tar.gz:

Publisher: publish.yml on BrorH/pycauset

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycauset-0.4.18.dev21-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pycauset-0.4.18.dev21-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 995edbdda4ab38adf2d46fa7fc386f1965150c5b2f711bb2de164e1fa3d2ddd6
MD5 658aa3fe06a7fd6133e113312e9e04ef
BLAKE2b-256 01d56397292a65b7f057522eefb4ab28eaca69c8400148c48464368a124e40f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycauset-0.4.18.dev21-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on BrorH/pycauset

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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