Skip to main content

Symbolic Pauli Heisenberg Evolution Engine.

Project description

sympauli

Symbolic Pauli Heisenberg Evolution Engine

Evolves quantum observables through parameterized circuits in the Heisenberg picture, keeping all coefficients as exact SymPy expressions. Vibe coded using Claude AI in one afternoon.

Install dependencies

pip install sympy numpy

Usage

from sympauli import PauliSum, evolve, gradient, expectation_value
from sympauli.gates import gate_Ry, gate_CNOT
import sympy as sp
import numpy as np

theta = sp.Symbol('theta', real=True)
n = 2

# Define observable
H = PauliSum.from_dict({'ZZ': 1, 'XI': 1, 'IX': 1}, n=n)

# Define circuit
circuit = [gate_Ry(theta, target=0), gate_Ry(theta, target=1), gate_CNOT(0, 1)]

# Symbolically evolve in the Heisenberg picture: U†·H·U
H_evolved = evolve(H, circuit, n_qubits=n)

# Symbolic gradient w.r.t. theta
dH = gradient(H, circuit, n_qubits=n, param_symbol=theta)

# Expectation value on a state
state = np.array([1, 0, 0, 0], dtype=complex)
ev = expectation_value(H_evolved, state, {theta: 0.5})

Package structure

Module Contents
pauli_string.py PauliString — symplectic bitmask representation, multiplication, embedding
pauli_sum.py PauliSum — symbolic linear combination, arithmetic, adjoint, simplification
gates.py 40+ standard gates as PauliSums: Rx/Ry/Rz, CNOT, CRy, RXX/RYY/RZZ, CCX, …
heisenberg.py evolve, gradient, expectation_value, validate
example.py Runnable demo: python -m sympauli.example

Qubit convention

  • PauliString.from_string('AB'): A acts on qubit 1 (MSB), B acts on qubit 0 (LSB).
  • gate_CNOT(control=0, target=1): control is qubit 0, target is qubit 1.
  • to_matrix() uses big-endian ordering: qubit n-1 is the most significant bit.

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

sympauli-1.0.0.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

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

sympauli-1.0.0-py3-none-any.whl (26.3 kB view details)

Uploaded Python 3

File details

Details for the file sympauli-1.0.0.tar.gz.

File metadata

  • Download URL: sympauli-1.0.0.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for sympauli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 48f47790d8189a6e2af92d3e7fd9eb4987717c92f32e81d8d42b4e54a4da7a7a
MD5 09bf2143e66367834bc4501f6ead854b
BLAKE2b-256 eafc843e112310679e3f8b0a1834983ae3924e9960c56e00de7e8dffe064b1d8

See more details on using hashes here.

File details

Details for the file sympauli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sympauli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for sympauli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ba97f05dc9aa5810bebe81eab819b012600742c66ff1ecb977f7e0245bc553a
MD5 d7fb3119dab27014fc034c112cb5f234
BLAKE2b-256 47f373ecd252f3a05170012de8564357621f7b942b5571b085697ab261c22b70

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