Skip to main content

Python SDK for Metatron Quantum State Operator - High-performance quantum computing on sacred geometry

Project description

Metatron QSO Python SDK

Python bindings for the Metatron Quantum State Operator - a high-performance quantum computing framework built on sacred geometry.

Overview

The metatron_qso Python package provides an easy-to-use interface to the Rust-based quantum computing core, enabling:

  • Quantum Walks: Continuous-time quantum walks on the Metatron Cube
  • QAOA: Quantum Approximate Optimization Algorithm for combinatorial problems
  • VQE: Variational Quantum Eigensolver for ground state energy
  • High Performance: Leveraging Rust's speed with Python's ease of use

Installation

From Source (Development)

Requirements:

  • Python 3.8+
  • Rust toolchain (install from rustup.rs)
  • maturin (pip install maturin)
# Clone the repository
cd metatron_qso_py

# Install in development mode
maturin develop --release

# Or build a wheel
maturin build --release

Using pip (Future)

pip install metatron-qso

Quick Start

import metatron_qso

# Create the Metatron Cube graph
graph = metatron_qso.MetatronGraph()
print(graph)  # MetatronGraph(nodes=13, edges=78)

# Run a quantum walk
result = metatron_qso.run_quantum_walk(
    graph=graph,
    source_nodes=[0],  # Start at central node
    t_max=5.0,
    dt=0.1
)

# Access results
print(f"Final probabilities: {result['final_state']}")

API Reference

MetatronGraph

The core graph structure representing the Metatron Cube.

# Create the default Metatron graph
graph = metatron_qso.MetatronGraph()

# Get graph properties
num_nodes = graph.num_nodes()      # Returns: 13
num_edges = graph.num_edges()      # Returns: 78
adj_list = graph.adjacency_list()  # Returns: list of lists

run_quantum_walk

Execute a continuous-time quantum walk.

result = metatron_qso.run_quantum_walk(
    graph,              # MetatronGraph instance
    source_nodes,       # List of initial nodes (e.g., [0] or [1, 2, 3])
    t_max=10.0,        # Maximum evolution time
    dt=0.1             # Time step
)

# Returns dictionary with:
# - 'times': List of time points
# - 'probabilities': List of probability distributions
# - 'final_state': Final probability distribution

solve_maxcut_qaoa

Solve MaxCut optimization using QAOA.

result = metatron_qso.solve_maxcut_qaoa(
    graph,              # MetatronGraph instance
    depth=3,           # QAOA circuit depth (p)
    max_iters=100      # Maximum optimization iterations
)

# Returns dictionary with:
# - 'cut_value': Best cut value found
# - 'assignment': Binary node assignment (list of 0s and 1s)
# - 'approximation_ratio': Solution quality (0 to 1)
# - 'meta': Additional optimization metadata

run_vqe

Find ground state energy using VQE.

result = metatron_qso.run_vqe(
    graph,                              # MetatronGraph instance
    depth=2,                           # Ansatz depth
    max_iters=100,                     # Maximum iterations
    ansatz_type="hardware_efficient"   # Ansatz: "hardware_efficient",
                                       #         "metatron", or "efficient_su2"
)

# Returns dictionary with:
# - 'ground_state_energy': Computed ground state energy
# - 'classical_ground_energy': Exact energy for comparison
# - 'error': Absolute error
# - 'iterations': Number of optimization steps
# - 'final_state': Final quantum state probabilities

Examples

The examples/ directory contains complete demonstrations:

  • 01_quantum_walk_basic.py: Basic quantum walk demo
  • 02_qaoa_maxcut_basic.py: MaxCut optimization with QAOA
  • 03_vqe_ground_state.py: Ground state energy computation

Run an example:

cd metatron_qso_py
python examples/01_quantum_walk_basic.py

Jupyter Notebooks

Interactive tutorials are available in notebooks/:

  • QuantumWalk_Intro.ipynb: Comprehensive quantum walk tutorial with visualizations

To use notebooks:

pip install jupyter matplotlib numpy
cd metatron_qso_py/notebooks
jupyter notebook QuantumWalk_Intro.ipynb

Performance Notes

  • Rust Backend: All computationally intensive operations run in optimized Rust code
  • Parallelization: Many operations use rayon for multi-threaded execution
  • Memory Efficiency: Minimal data copying between Python and Rust

Typical performance (Intel i7-12700K):

  • Quantum Walk (single step): ~31 μs
  • QAOA iteration (depth=3): ~2-5 ms
  • VQE iteration (depth=2): ~3-8 ms

Development

Running Tests

# Rust tests
cd metatron_qso_py
cargo test

# Python tests (if implemented)
pytest tests/

Building Documentation

# Rust documentation
cargo doc --open

# Python documentation
pdoc metatron_qso

Architecture

The Python SDK architecture:

┌─────────────────────────────────────┐
│   Python API (metatron_qso)        │
│   - MetatronGraph class             │
│   - run_quantum_walk()              │
│   - solve_maxcut_qaoa()             │
│   - run_vqe()                       │
└─────────────────────────────────────┘
                ↓ PyO3
┌─────────────────────────────────────┐
│   Rust Core (metatron-qso-rs)      │
│   - Graph structures                │
│   - Quantum state evolution         │
│   - VQA algorithms                  │
│   - Linear algebra (nalgebra)       │
└─────────────────────────────────────┘

Related Documentation

License

MIT License - see LICENSE for details.

Support

Citation

If you use Metatron QSO in your research, please cite:

@software{metatron_qso,
  title = {Metatron Quantum State Operator},
  author = {Sebastian Klemm},
  year = {2024},
  url = {https://github.com/LashSesh/qso}
}

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

metatron_qso-0.1.0.tar.gz (220.2 kB view details)

Uploaded Source

Built Distribution

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

metatron_qso-0.1.0-cp314-cp314-win_amd64.whl (316.1 kB view details)

Uploaded CPython 3.14Windows x86-64

File details

Details for the file metatron_qso-0.1.0.tar.gz.

File metadata

  • Download URL: metatron_qso-0.1.0.tar.gz
  • Upload date:
  • Size: 220.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.1

File hashes

Hashes for metatron_qso-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d21271827046819df6d737301e910d6532b6cc15288771991eff7e6ecd1fcebd
MD5 44c365d2b23bc6c2c0d8460d05d22b53
BLAKE2b-256 e11ba5d5112b8b1e567808b95009d6cee2735008143675eb71b0c455b46fb474

See more details on using hashes here.

File details

Details for the file metatron_qso-0.1.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for metatron_qso-0.1.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 edeae835dbf3e019ea0aa58f4cef0b07e7d6e761b9b89eefafe1f7d9bd6093a2
MD5 70ecd26365b638a7d789831c14d7952b
BLAKE2b-256 f0ab7465c6155308a827b6f7f157f0ca659eef92991b558bbbd6a7da15251937

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